why not combine the best features of the all existent programming languages and fit it in a universal programming language?
Why can't there be an "universal" programming language that serves all purposes? [closed]
23The term 'best' is subjective, so you'd never have a univerally accepted best. There are, of course, quite a few languages that are suitable for broad ranges of development across all platforms. C++ and Java being the main two.– GrandmasterBSep 17, 2010 at 19:19
6@GrandmasterB You forgot C#– Daniel LittleMar 24, 2011 at 1:04
16There is, it's called 'C'– Martin BeckettMar 24, 2011 at 4:41
9we as a species have an innate ability to disagree (by virtue of our individuality), therefore we will never agree on what is universally required, and hence there will never be one (at least not one created by humans!)– NimMar 24, 2011 at 17:04
9A universal programming language? You mean, analogous to the universal human language that everyone switched to so many years ago?– KyralessaAug 20, 2012 at 13:41
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...
26For the same reason you do not bring a minivan to a drag race. For the same reason you do not bring a water pistol to a duel.– ChrisSep 17, 2010 at 19:42
22@Chris What if it is a water pistol duel ? Sep 18, 2010 at 15:43
44For the same reason you never go in with a Sicilian when death is on the line. Sep 18, 2010 at 15:44
6If you had a swiss army knife that did all the things you needed to build a house, would it be any good at any of them? Oct 5, 2010 at 20:00
6This answer is a horrible analogy. Perhaps if you had written: because the french language allows a different fidelity of expression than the english language, I might have liked the analogy better. But computer languages are not 'things', nor human languages. The correct answer is: we do not know. It'll require more insight in how humans express logic and how they arrive at this point. Furthermore, some languages are 'meta-languages', able to express other DSLs. Should we include these in your question?– DibbekeAug 20, 2012 at 6:09
- 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.
You stopped short. I was expecting one of those ha-ha-only-serious "Top 10" lists. Sep 18, 2010 at 4:30
4+1 for preventing, at least for now, a "Save the Babel Fish" campaign. Damn hippies. Sep 19, 2010 at 23:31
3as for the Babel Fish, make sushi!– Muad'DibJan 29, 2011 at 7:47
1Regarding point 1, all legacy code will eventually either have to be re-written anyway using the latest fad in code/libraries or will be unable to run effectively without ridiculous amount of support costs. Oct 19, 2014 at 4:06
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.
3Most sites that actually make money will lose more than $100 if they experience significant downtime. Not to suggest that it's comparable to a life-or-death situation, but still, this is downplaying the risk more than a little bit. Aug 30, 2012 at 0:40
3Do you have any idea how flakey Facebook is. They recently posted they push code every 37 minutes. Their site is constantly borked in some way or another and they have a million tickets in their backlog. The point is with the web nobody is going to die, you "might" loose a few sales, but all in all not really much risk. Most of the issues you face are only going to affect a few customers not the whole base Aug 30, 2012 at 2:23
- 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.
That's for including "parent's garage." That really makes it clearer, since I do not have a garage. Jan 29, 2011 at 7:01
5A better analogy would be a language is like a toolbox rather than some individual tool. Jan 29, 2011 at 15:00
4There may be 20 different tools in the box. But I bet you only need one language to describe them.– ThomasXDec 12, 2011 at 12:03
2These days the toolbox is more like the libraries available for the language in question. Oct 19, 2014 at 4:10
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.
4All the world is not a PC. The majority of processors on this planet have less than 64K bytes of total memory space. A language that can be used on these processors has to be so far reduced from those that most on this forum seem to use that your universal language will end up as an enhanced assembly language. I think that would be called "C".– uɐɪMar 13, 2012 at 11:05
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.
but if this features was enabled/disabled accordind to the necessities for example: you could enable type aware reflections and disable loosely typed language capability and so on...– killownSep 17, 2010 at 19:21
2and if you were to try and combine a bunch of languages' features into one language which could do anything, you'd get a lot of redundancy, confusion, bugs from all the different ways to use different combinations of features, and a lot of wasted effort specifying which paradigm you're using on this line.– user2348Sep 17, 2010 at 19:22
killown you are right, but solving the problem by making the language ultra-configurable makes the language difficult to use as fennic describes. I like a flexible language that allows things even if they are dangerous in some cases, but the level of configuration you would need to combine some concepts would make it more complex than to just drop back and write the solution in low-level C or something.– BillSep 17, 2010 at 19:47
1+1 for conflicting features Sep 17, 2010 at 19:57
I think the issue isn't just that language features conflict, but rather that many languages assume an underlying framework which includes features that impose a certain level of overhead, but allow certain operations to be simplified. Languages also typically have certain 'typical usage patterns' associated with them. The selection of what features should be included in a framework, and what coding patterns should be employed, involves trade-offs; and different combinations of features and patterns are better for different applications.– supercatAug 20, 2012 at 15:45
"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.
2"In some other languages, the idea of time travel would never occur to its speakers." Citation needed. The Sapir–Whorf hypothesis is not by any means widely accepted specially in its strong form. Aug 21, 2012 at 13:43
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
"Structured programming languages (C, Pascal) - takes out "goto", replaces with procedures and structured loops etc." - Sorry, you're wrong there: C has
goto. But I like the rest of the answer. The main thing C does is let you not care about exactly where in memory everything is and what is in what register at what time, and it hides the program counter (in terms of the precise address it's sitting at, again. You can move it at almost an assembly level of precision with a goto). Aug 4, 2016 at 2:14
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.
Because of something I call the "generalization/specialization paradox", which probably has another name and really isn't a paradox
The more generalized a programming language the more code it takes to accomplish something. The more specialized the language the less you can accomplish with it.
2I'd agree with you except that it's possible to have specialized libraries in a generalized language. Mar 24, 2011 at 6:12
@dan: Agreed, but only if the language focuses on providing features to library writers. My two favorite languages are D and Python. Both are fairly generalist languages (especially D) but both have lots of features for library writers, so you can build your own libraries to handle the specialized stuff. I despise super domain specific languages like Matlab and R.– dsimchaApr 22, 2011 at 0:12
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'...
1The problem is deeper than that. The more options you make available, the more has to be specified explicitly instead of being the one implicit way things work in that language. The problems get more obvious if, instead of comparing Java with C#, you compare Java with Prolog. To have the features of both in one language would complicate the syntax of the compound language. A more reasonable choice may be to reduce syntax to a minimum, and allow any feature to be implemented as a metaprogramming library. That's basically what Lisp does, though it's core isn't low level enough for some jobs.– user8709Apr 22, 2011 at 2:17
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.
I would also argue that it's neither good nor bad but rather an artifact of the fact that software engineering is not even a hundred years old, and is very immature compared to every other kind of engineering in existence. Oct 19, 2014 at 4:15
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.
6Machine language is not universal; not even close. Each machine has its own language.– hasenMar 24, 2011 at 5:38
3Also, it's not a string of 0-9 and A-F. It's 1's and 0's. Mar 24, 2011 at 11:42
@hasen @David is it not reasonable to suggest like @Andy has that every language is, from one point of view a domain-specific language, built on other languages?– ArmandMar 24, 2011 at 16:48
I said 0-9 and A-F because that's what you had to know to use the multi-punch codes on a keypunch machine. It looks like 0-1 or 0-15 or 0-255 if you take it as numbers, depending on how big a chunk at a time. And hansen is right; every TYPE of machine has it's own language. Almost all PC's today accept 80386 codes; even my phone will! But the iPad won't. Apr 15, 2011 at 6:48
@hasenj and with widely different characteristics. The mindset required for programming a 6502 is different from programming an x86 and in turn different from a RISC chip. Very far from universal.– user1249Aug 20, 2012 at 6:57
there is not an UNIVERSAL computer.
not an UNIVERSAL plateform.
not an UNIVERSAL programmer.
and not even an UNIVERSAL client.
So simply we need a different one for a different one. ;)
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.
1I've never seen any decent corporate project using less than 4 different languages. And I do not believe in any of that "benefits" from selecting unfit tools. It never work.– SK-logicMar 24, 2011 at 13:13
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.
Agreed - we mostly only really need a high level "safe" language, a low level "unsafe" system programming language, all the assembly languages (one per CPU, they're unavoidable but hidden), plus some special purpose (domain specific) languages (e.g. SQL). The real problem is that it's impossible for anyone to declare a language "deprecated" (even when the language designer tries to do it - e.g. Python 2 vs. Python 3). More new languages each year and no old languages discarded means that eventually there will be more languages in use than programmers to use them. ;-)– BrendanMay 19, 2013 at 14:47
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.
1"Saved money" is (despite accountants best endeavours) a vague and nebulous concept over the life-cycle. Just as mechanics have failed to standardise on even a single spanner size, never mind a whole toolkit, software engineering has failed to standardize because there are so many criteria for selecting a tool (language) or even the processor/OS/environment– AndrewOct 4, 2012 at 8:23