共用方式為


Everything but the language design…?

So I’ve been reading some history of programming languages. And one question that came up a lot is ‘What made this language popular? Why did it live, where others have failed?’ There have been a bunch of different answers, for different languages, and they don’t really have much to do with language design. And it seems like it’s usually not just one thing that goes right being enough. So here is my own attempt to collect a list of things that helped.

1) Start small and with a goal. Then iterate a little. I draw this conclusion from hearing about LISP, SmallTalk, Forth, C, C++, Pascal that they didn’t come from really grandiose designs to take over the world. The projects started with some small goal to achieve, and were happy to achieve success for that goal with some very small level of proving a point, or being adopted by a small community. This will help you achieve point 2:

2) Don’t be vaporware - have a real implementation early and make it as available as possible.

3) Be easy to port the compiler and the language. Because otherwise you’re going to be running only on one system, or you’ll be generating code for one system, and systems tend to die off in popularity over time being replaced by new ones. There are a lot strategies that come up as answer to the ‘be easy to port’ criteria:

3a) use a frontend compiler architecture generating C (or other highly portable language) code

3b) generate code for a virtual machine [e.g. PL/0, Forth]

3c) be a very compact language to define, and therefore easy to implement a boostrapper interpreter (e.g. LISP, Smalltalk)

3d) be self-hosting (compiler written in its own language), so that if some small set of core-language features can be ported in a bootstrap compiler, it can then compile your main compiler can

4) Have some major commercial backing to attach to that will promote your language! Seriously, this has helped a lot of languages over time. :)

5) Once you have a few too many implementations, get standardized. Or at least have a draft standard. Or have a single authoritative reference implementation (maybe open source). Otherwise eventually people are going to say your language is too fragmented and they don’t know which flavor to adopt, and with choice overload they probably won’t choose your language at all.

6) Be lucky.

Having read a bunch of stories now, I think I have decided the programming language story I really like is Forth. Because it’s the story of how one stubborn guy can decide he is wasting too much time learning all these languages which won’t let him do exactly what he want with the underlying machine/OS, and decide he only wants to need to know one perfectly powerful and simple language for the rest of his life, and he figures out a way to do just that:

-he defines a simple abstract machine architecture
-he defines a simple and powerful language which supports structured programming and code reuse, without all these other complex features everyone wants to put in their languages
-he writes most of the compiler in self-hosting fashion
-any time he has a programming project he just ports the compiler bootstrapper and virtual machine to whatever architecture, and he can reuse all his knowledge on a brand new system.
-bliss…?

Even if his language never catches on with the mainstream he can still be quite a productive programmer in his language anyway, especially since he can keep tweaking the language to his own liking.