Can one programming language work for everything?

There are all kinds of programming languages, and they all have their strengths and weaknesses. Sometimes you want fast prototyping, sometimes you want massive scalability, sometimes you want easy availability of a large library of preexisting code, or access to a specific framework.  Strong typing is useful, duck typing is useful, running on a virtual machine platform is useful, avoiding memory compaction is useful.  Can we get all that stuff in one language?

Given what we know now about language design, is it possible to design a language from scratch, that would work in all those contexts?  In practical terms it’s not very interesting to consider a language without also considering it’s implementation, (virtual machine, compiler, optimizer, etc) so we’re really talking about a software design for an implementation and talking about a language design at the same time.  Maybe it should be called a “programming system”.

Strong typing

One idea I think would be interesting to explore would be whether you can get the benefits of strong typing in a language where types were optional.  There’s a common rhetorical trap here that goes something like this: You have to force everyone to use strong typing, otherwise people won’t do it, and you won’t get the benefits.  I’ll call that the “paternalistic fallacy”.

You want the ability to say that a  module should abide by specific typing policy, and have the system enforce that. That makes it easy to use the system in different ways depending on the needs of your situation.  If you just want to conjure up a quick prototype, you shouldn’t need to define lots of extra typing goop. When you want to export that code and let other people use it, and test the heck out of it, you want to change the typing regime.

Essentially all types can be thought of as an assertion that could be applied at runtime instead of compile time.  Types allow the compiler to optimize in very important ways, like not doing a dynamic lookup for all methods calls. Types allow you to verify the correctness of your code, like trying to assign a floating point constant to an integer variable.  In my mind, these factors boil down to optimization and assertion checking. These features are crucial to have when you need them, but they’re not always appropriate.

4 Responses to “Can one programming language work for everything?”

  1. dtkerns says:

    short answer, yes. what language? C. why? because if you can’t do it in C (the way you want to), you can write a new language in C and then do what you want in that new language.
    for fun, list all the languages you know that are written in C… (the first one is C)

  2. Chris Quenelle says:

    There’s no doubt that C has a distinguished place among programming languages, but C isn’t always the best choice. Shell scripts play an important part in the overall software ecosystem, but most programmers don’t think of them as “real” programs. A language where you could write quick and dirty programs as easily as you can with a script, and still write structured and efficient programs, like with C, would be very useful.

  3. dtkerns says:

    I would definitely include “the shell” as yet another language written in C. shell, awk, sed, lex, tcl/tk, (modern) fortran, php, java, lua, etc, (perhaps you remember that the first C++ compilers translated C++ into C!)… ALL of these “great” languages, all written in C, because someone didn’t like the way C worked for a particular problem. Perhaps I’m only bringing out the fact that “the parser” problem is considered “solved” (using C.) But, regardless, if given the choice of a single language, only a fool would chose something other than C.

  4. Yes, it is C.

    when you want to write a real program having all the features of speed, clean, memory management, multi-threading, maintainable, regardless small, big, linux, unix, windows, or when you want to open your creativity … or find a ready package to call, you directly start thinking of C.

    but recently I started getting interest of JAVA, which is somehow a velvet C like language, free me to do things in a quick way, without any worries about memory management, and you can mildly mix toys together, to add wings to a fish 😛

    C++ I never liked although I uses for a long time, but it looks like C and JAVA Hybrid.

    currently, I am not programming at all since long time, but still like to create my own tools, and I started to believe that any programming language goes away from 4th generation languages standards, and has no foundation libraries or classes, it will never succeed ( like BASIC), C succeeds always because you have everything you want, and you feel aways thousands of people thought of something before you and prepared it as a ready library (and very famous library even), just to learn and use.

    when I write a program in C, I’ll not worry about the .Net or Java Runtime Environment is there on my friends/colleagues PCs or not, just send the binary/executable and do not worry about the rest, your program will be your man!

    I am not trying to tell that C is perfect, I wrote some program that reads complex and different structures, in C it was very complex, and even I could not continue maintenance, so, I decided to transform my experience in writing this program to be done in OO, I shrunk the size of the program to 1/10 or the original one, and it is still maintainable.

    I wish to find C language, and Java are mixed in C powerful and native compiler, and java cute way of dealing with OO, classes, and ignoring the stupid prototyping in C, and can call C previous libraries, and not to lose the powerful memory allocation or to access the byte as byte.

    I did not meet a language that mixes between java way of using implicit pointers and declaring pointers when necessary.

    finally, Google created a strange language called Go, I tried to use, but it looked to me something like a nightmare, although when I recognized the language features it was amazing, but I could not digest the way I have to write its programs, and when I came back to my program I could not remember what I was trying to do there!!

    Finally C is the base of everything, it will keep so, until they invent different computing theory in the next 10,000 years.