why not combine the best features of the all existent programming languages and fit it in a universal programming language?
For the same reason you don't use a Swiss army knife to carve a chicken...
The Swiss Army knife generally has a blade, as well as various tools, such as screwdrivers and can openers and many others. These attachments are stowed inside the handle of the knife through a pivot point mechanism...
The design of the knife and its flexibility have both led to worldwide recognition...
- nobody wants to rewrite all the legacy code.
- It's difficult to agree on all the purposes
- Once you put together a comprehensive list of purposes, they would change before you could get it built.
- Somebody would start a completely different language due to a new purpose.
- Open Source
- What would we do with all the Babel Fish?
- Couldn't even make SQL universal.
What you have in programming is a very large problem domain. This domain ranges extremely and in many directions.
This is why embedded flight controllers are written in C and websites are written in PHP, Java, Rails, .NET and a host of others.
For the embedded flight controller I have about 128k of memory to work with and on top of that if my code gets an unhandled exception the plane crashes, 200 people die and I get sued to tune of $1B, and have to send engineers to every airport in the world to fix aircraft that are grounded loosing my customers $10M / day. I have to work with a language that is very tight and has a small number of moving parts that could go wrong.
For my web application I have several GB of memory to work with, but network speed is limited (to a lesser degree everyday, but this is probably the web greatest limit). I will be looking at a language that gives me a ton of features and produces output that can be transmitted as fast as possible. I don't really care if my site goes down, I will maybe lose a few sales ($100) and have to patch the use case that bombed, no big deal.
Web sites haven't been written in C for over 15years (anybody do any cgi scripts?) and as far as I know flight controllers are just now beginning to look at C++, but even then in a very restricted way.
- Go to your garage (or your parents' garage).
- Open the tool box.
- If you see more than one tool, think about how that applies to your question.
If you have no toolbox, or only have one of those little hammers with the screwdriver bits in the hollow handle, then I have great sympathy for you.
Seriously. If you go to an auto shop, does your mechanic have only one single do-it-all tool in his toolchest? He (or she) is a professional, with professional-grade tools specifically designed to perform various automobile repair tasks.
Similarly, professional software developers should possess a sufficient set of tools to perform his/her trade. If you open your toolbox and see only [the software equivalent of ] a Philips screwdriver, then you cannot consider yourself a professional.
You can turn a bolt with an open-end wrench, a box-end wrench, a ratchet wrench, or an adjustable wrench. You can even turn a bolt in a pinch with slip-joint pliers, clumsily, with minor to severe damage. But it is quite difficult to turn a bolt with a sledge hammer.
A different kind of answer to the others - I actually think there is potential for a language to become a "universal" one, allowing the features and paradigms of many other languages, though not perhaps a strictly designed language you might be thinking of.
To use brettmjohnson's analogy above, the idea that each programming language is the tool inside a box (or on a swiss army knife) is the assumption everyone is making, but is really a flawed assumption.
What if the programming language was the toolbox?
I mean, what if you can add and remove features from the language as you please, and have your own toolbox with the tools you need in it - even if the tools are for different purposes.
The concept exists partially already. For example, languages like Nemerle allow you to add syntax to the language, and as such, you might be able to take "the best feature from language X", and add it to Nemerle (or your own). This doesn't necessarily mean writing your own macros all the time either - each language (or paradigm) could be defined inside a macro in a standard library - such that a you could
import Haskell; import Prolog;, and begin writing the two languages as if it were part of your language?
The question then is - how do you get the features of different languages/paradigms to work with each other? While I can't answer that, frameworks like .Net and JVM offer some of the solution - the languages are at least partially compatible because of the way they're compiled. You can take any code written in C# for example, and use it from F# without complaints.
The 'problem' with the solution as it is today, is that using these languages together requires you to create them as separate projects, which cannot reference each other - you can only have a 1 way reference. The language barrier is that each project compiles all it's files separately to Common Intermediate Language before any other project can access it.
A stepping stone towards removing that barrier would be to allow code of different languages (eg, C# and F#) to compile inside the same project. In theory you could compile each file separately (or in groups - if they have partial types or circular references), and then compile files of a different language which can access those already compiled (CIL) objects. You would need to strictly define the order of compilation for this to work though - but order of compilation is already required in the case of F#.
Anyway, I'm not saying "there can definitely be a universal language". I'm suggesting that there's the potential for much better interoperability between languages that what currently exists. In reality, it's not likely to improve greatly very soon, just because of the huge amount of work it is to implement a language and the libraries, the tools etc. needed to use it.
The best features of some languages conflict with the best features of others.
For example: Type aware reflections is a really nice feature, but it would not be worth very much in a loosely typed language, but loose typing can be a real benefit at times as well.
Even within one language you cannot always use all the best features at the same time because they conflict with each other.
"Jack of all trades - master of none." springs to mind.
Some programs require speed, others large amounts of memory or fast access to the disk. Some languages are good at one, but bad at another - I don't think you'd get a language that was good at all.
So, while you can write virtually any program in any language, what you get isn't guaranteed to be the "best" program you could write to solve that problem.
Languages shape the way people think. This is true for natural languages. If a child knows only one language with the numbers "one, two, many", teaching that child math is... difficult. (Sorry, I don't have the link) In english we talk about different times as if they were places - hence the concept of time travel is possible to imagine. In some other languages, the idea of time travel would never occur to its speakers.
This is also true for programming languages.
Hence if we have a single programming language, everybody will think about all computational tasks exactly the same. Thus we won't be exploring alternatives, and the best way to do something will remain undiscovered.
The closest thing we have to a universal language is C. C maps very closely to the underlying hardware concepts (how things actually get done in hardware) and programs in every* language is convertible to C. (See how CFront used C compilers for assembler tasks) The problem with C is basically that the above-mentioned conversions wouldn't make sense from a C programmers perspective.
"Lambdas" were always possible in C. The syntax is off, including code spread around the whole project/file, hence it was not a preferred solution. With a no-capture/upvalue/etc version, define a function somewhere else, and pass a pointer to the function. (see qsort()) To use lambdas with captured values, the quantity and complexity of the code you have to write rises a lot - as far as I'm aware noone ever actually wrote the code to use this method of programming in C. As opposed to languages where lambdas are part of the language, and basically used everywhere.
The main difference between C and C++ is how you can ask C++ to take care of stuff for you; but then you can no longer see, from only a single line of code, how much you're really asking of it. The answer becomes: it depends (on all this other code).
Some programming languages are excellent for specific tasks, but where most current programs in use around the world would simply not make sense if programmed in that language. That is, if the language could be used to implement that program to begin with, which is not a given.
It is a mistake to think that "combining all features" will make a better language.
You are more likely to end up with a bloated, complex, unreadable mess.
Good language design requires choice and trade-offs to be made. Arguably the best / most revolutionary / most successful languages are the ones that take something out and provide a better alternative rather than add new things in. e.g.
- Structured programming languages (C, Pascal) - takes out "goto", replaces with procedures and structured loops etc.
- Java - takes out "manual memory management", replaces with GC/managed memory
- Haskell/Clojure - takes out "uncontrolled mutable state"
- Lisp - takes out most "language syntax", replaces with a flexible homoiconic tree of s-expressions
There's a great talk on this top by Uncle Bob Martin - The Last Programming Language
There is. None tool is the best to everything, but some tools like many programming languages serve to all purposes, not best to all.
You can choose the best tool for the job but there are programming languages able to be used on all purposes and you can choose them. I don't recommend it but it's possible.
The impossibility on technical merits of having a Universal Language? That's total nonsense. You could have a universal language that covers all bases. The problem is mostly historical: different languages were invented to do different things and be used in different communities. Many of them stuck. Add to that preferences (vi! emacs! wait, I meant Java! C#, wait I meant Microsoft, Open Source, etc. etc. etc.) and general embedding of historical accidents... Look at the natural languages in a tiny land mass like some European countries to see just how crazy this topic can become. Some towns have their own pride and joy, a little dialect that only they speak. Nations and programming communities are not that different, nor are programming communities more rational. If they were, we would all speak esperanto and program in Universal somethin' somethin'...
Still Cobra looks promising in the direction of having all the nice features from other languages. :-)
Because if you create such a language, it will be yet another new language. You might get a large fan base, but all the other languages will still exist.
C still exists even though many new languages were invented since.
You could say that python is such a universal language, but then there's also ruby.
The reason there are many language is simply because there are many programmers and some of them like to create new languages.
The reason there's no single universal language that everyone agrees on is that programming as a craft is not dictated by some institution that makes all the decision. Everyone is free to do what they want.
That's a good thing.
With all that is written so far, it is hard to add much new rationale, but I will throw in a few.
Evolution : It is not just biological systems that are introduced, mutate and undergo a survival-of-the-fittest competition for resources and a niche to call their own. The competition is good and pushes things forward.
Maturity : We have been making computer languages for probably less than a century. We can't have the answer yet because we don't even know all the questions yet.
Separate genesis : Not sure the right word for this, but in the world their are many writing systems that started in many geographic regions. Think about Cuneiform that was dictated in part by the demands of carving into clay tablets. Think about Sanskrit, the Greek, Hebrew, Roman, Arabic alphabets. Hieroglyphics, the Chinese method of beautiful writing with 6000+ symbols that is shared in many east Asian countries. Think of more modern mixed alphabets with phonetic basis like Cyrillic, Katakana, and Hirigana. I am not a linguist so don't flame the inaccuracies too harshly, but when cultures worldwide need something, they will create it and make it their own out of necessity. Computer languages came along when there was a lot of worldwide communication and like the Imperial and Metric systems, came from places with powerful idea leadership. But programming languages serve many different cultures (some of them corporate cultures), so they reflect the people who made them. Computer languages come with cultural legacies that shaped their design and use. In the OS kernel culture, C and C++ are unlikely to be soon deprecated for Java (or the other way around) because they permit native code generation, close / efficient coupling with hardware for creating hardware abstraction layers, and have a sizable installed based.
Design of Design : Programming languages come about using different organizational paradigms. COBOL and Ada were from committees that were part of DOD which had a lot of hierarchy. If I recall correctly C, C++, Java, and probably many others came from one or a small number of designers. Fred Brooks compares the results of the committee vs. the visionary based approaches in his paper, the Design of Design (http://www.youtube.com/watch?v=pC-DlX-PaF4). If we sat down today to either select a Da Vinci or a committee to define the universal programming language, would we know who or what by what method it should be architected?
Maybe a little different slant on all this:
What is a language? To be ridiculously simple, it's vocabulary, syntax, and semantics.
What's the first thing you do with a programming language?
You define things - classes, variables, methods - you extend the vocabulary and the semantics.
Why? So now you can say things in it you could not say before.
Like it or not, you've made a new special-purpose language.
IMHO, the thing to look for in a general-purpose language is if it makes it easy to create special-purpose languages.
Aside from the swiss-army-knife argument (which has a point -- it is more difficult to design a good wide-spectrum language than a domain-specific one -- but that doesn't mean such a language wouldn't be both possible and a good idea), there are problems with "combining the best features":
- For language features, "best" is subjective, or at least (interminably) arguable.
- Some features aren't compatible; a good feature from one language may blow up when combined with a good feature from another.
- We're not done coming up with new features yet.
In short, language design is harder and more complicated than that. Although, you may want to take a look at Scala.
Visual Batch is an attempt at customizable programming language. The Link Below shows how this programming interface can be adapted to suit the needs of a Universal Programming Language.
There is a universal programming language. It's called "machine language" and everything in any other computer language is ultimately executed as machine language.
What does it look like? A string of 0-9 and A-F.
But it's a bitch to use. So Alan invents a language that can be translated into machine language and is more appropriate to what Alan wants to do. Bill invents a different language for what Bill wants to do. Before long you've got Cobol and Fortran and Lisp and Java. All of them are just simplified vesions of machine language, easier to write certain kinds of programs but harder, or impossible, to write other types of programs. One is good for accounting, another is good for controlling the space shuttle.
Most answers here focus on using the best tool for each problem. I don't believe this is a good enough reason.
If you look on large companies then usually the company will tend to use a single (or a small number) of languages and technologies, even if for a specific project theres a some what better language.
This is done because the benefits that arise from improved standardization, easier support, code sharing, etc. are (most times) larger then the added value of a specific language.
I think all the "because you don't carve statues with a pencil" answers are missing the point.
Who here, TRULY selects a language before every new project?
The truth is, we only need a few programming languages, and the programming world would be better off that way: people would focus on making the scripting language better instead of being scattered across python/ruby/perl/younameit for example.
C# is programmed on/for windows (alright, there's Mono, anybody here runs a C# under Mono app every day?) and that makes users buy Windows7/8, and that makes money for Microsoft.
Other companies do the same, then open source knows better, then mister genius too... and we got lots of look-alike languages, it's just humanity's self-centered nature.
We must look to economics to answer this question. If it saved business money to have just one language, we would have it. They would standardize on it and require everyone to use it. The other languages would languish in dusty academic buildings and the basements of wild-eyed enthusiasts. This has not happened, so their must be no profit incentive in a universal programming language or one would have naturally evolved by now.