Is there a chance for such a language to exist? A programming language that supports many paradigms and can be used everywhere instead of the myriad of languages/tools we have today.
The closest thing I can think of would be Lisp (any dialect) because of the ability to add embedded languages/DSLs to the language. Pure Common Lisp (no macros), does not have any iteration constructs (besides goto). On top of these basic primitives you could build something much more complicated such as the 'loop' macro, a DSL for describing iteration. Here is the second problem on project euler (sum of even Fibonacci numbers up to 4,000,000) solved using loop.<p><pre><code> (loop for n = 1 then (+ n n-1)
and n-1 = 0 then n
while (<= n 4000000)
if (evenp n) ; predicates in CL end in 'p'
sum n)
</code></pre>
You can add almost any (AFAIK any) paradigm you want. Initially Lisp did not have any object system. When OOP became a thing it was added to Lisp. Today it exists in the form of CLOS, a very powerful object system which at its core is two macros, defclass[0] and defmethod[1]. Logic programming can also be added through the use of macros[2]. Here is an example of append written using logic programming in Lisp (compare it to the Prolog version).<p><pre><code> (<- (append nil ?xs ?xs))
(<- (append (?x . ?xs) ?ys (?x . ?zs))
(append ?xs ?ys ?zs)
</code></pre>
The thing is you can make Lisp any language you want it to be. Want a (better) language to write HTML, you can do that[3]. Want a language which can parse ATNs (augmented transition networks), you can do that[2]. You can add to Lisp almost any feature you can think of. This is what makes it appear (at least to me) as the "universal language".<p>[0] <a href="http://www.gigamonkeys.com/book/object-reorientation-classes.html" rel="nofollow">http://www.gigamonkeys.com/book/object-reorientation-classes...</a><p>[1] <a href="http://www.gigamonkeys.com/book/object-reorientation-generic-functions.html" rel="nofollow">http://www.gigamonkeys.com/book/object-reorientation-generic...</a><p>[2] <a href="http://ep.yimg.com/ty/cdn/paulgraham/onlisp.pdf" rel="nofollow">http://ep.yimg.com/ty/cdn/paulgraham/onlisp.pdf</a><p>[3] <a href="http://allegroserve.sourceforge.net/aserve-dist/doc/htmlgen.html" rel="nofollow">http://allegroserve.sourceforge.net/aserve-dist/doc/htmlgen....</a>
Well, if you are asking for the most versatile programming language, I would point to Oz:<p><a href="http://mozart.github.io/" rel="nofollow">http://mozart.github.io/</a><p>"The Mozart Programming System combines ongoing research in programming language design and implementation, constraint logic programming, distributed computing, and human-computer interfaces. Mozart implements the Oz language and provides both expressive power and advanced functionality."
Well since people are going to answer with languages they think are universal enough anyway, I'll say what I think comes closest to a universal language at the moment. Keep in mind, I do my daily programming in Ruby and Javascript, and my hobby/personal projects in Haskell so I'm not a mindless Microsoftie.<p>The language that I know comes closest to a universal language is C#.<p>C# has a rich static typesystem with generics, is typesafe, has a garbage collector, can be precompiled and has runtimes for most operating systems.<p>C# also has a dynamic type system, that can be enabled with a keyword.<p>C# has an embedded functional language, has function references and lambda expressions.<p>C# has extensive libraries for Server applications, CLI applications and GUI applications, including asynchronous and syncronous I/O, events and accelerated graphics.<p>C# supports reflection and code generation at runtime.<p>Over the years Microsoft has managed to cram almost every programming paradigm that's out there into C#, yet has carefully avoided it becoming a multi-headed unusable monster like C++ is (I'm not saying you can't write beautiful code in C++, just saying there's a lot in there that you shouldn't do).<p>About the only thing that's not in C# as far as I am aware is predictable/high performance, like C and C++ have. You can not disable the garbage collector and can't embed machine language.<p>So why, if I think C# is such a cool language, don't I use it? Well.. I just really like Ruby's type system and syntax. And I just really like Haskell's typesystem and syntax. There's really no need to have all features in one language when you can do just as well with multiple programming languages that might have specific advantages.
It is not exactly what you are asking, but the answers are about the same as if you asked "Why can't everyone just use X?"<p>Beyond the language and deployment factors, languages are optimized for different human factors. Some languages give up a lot of expressive power and flexibility in order to optimize the performance of large teams of developers with relatively poor code discipline. But for me personally on my side projects I prefer to have features like stronger static guarantees, less boilerplate and more expressive power. It seems hard to reconcile these different approaches in a single language.
Many new paradigms can be defined not by what they add, but what they take away.<p>The most obvious example is GOTO. It's a very powerful tool. A GOTO can do anything you can accomplish with an IF, WHILE, FOR, etc. yet we got rid of it because that incredible flexibility made it hard to reason about. The result was structured programming.<p>Object orientation can also be looked at as the removal of shared global state. There are multiple definitions of OO, but I like Alan Kay's definition best. He said the two primary principles are encapsulation and message passing. Encapsulation is obviously the one I'm touching on here. Some people include class hierarchies and open recursion in their definition of OO, and those certainly do constitute new functionality, but as I said, I prefer Alan Kay's definition.<p>Functional programming can be looked at as the removal of mutation. Where once we could create side-effects whenever we pleased, FP tells us that we probably shouldn't. Removing mutation makes it easier to reason about our programs, just like removing GOTO.<p>Haskell goes even further and removes implicit ordering of execution. Because the language is lazy it probably won't execute your code in the sequence you were expecting. Due to immutability and referential transparency everything works out just fine anyway. This makes certain kinds of algorithm much more performant (Huett zippers come to mind).<p>Instead of asking what new features we can add to languages, perhaps we should ask what else can be taken away.
Programming problems are diverse, and so are languages. It's similar to what we have in human languages - if you're talking deep specifics of medicine, it's quite different than if the matter discussed is car performance, even if both languages are based on English.<p>I'd hesitate to point to Lisp, with its ability to be "programmable programming language". The modus operandi, explained by e.g. PG, is to create a domain-specific language and then solve the problem using that DSL. This way you can have a great variety of problems which are relatively accessible by such a language... Would like to know more alternatives to the topic.
This is a lot like asking: "Could there be one tool that supports every function and task in the field of carpentry?"<p>Maybe? But who would want to use something like that? Good programming languages, like most useful tools, are specialized. They support modes of thinking that allow effective problem solving, each within its own domain. (Think Haskell vs Java).<p>In other words, programming languages are tools, and tools are useful because they are limited.
Put another way: can a programming language be specified without any compromises to hardware, environment, programmer or use case?
I'm going to go with the same answer that I have for the existence of god* or alien*. I don't know, but current evidence would suggest that the most probable answer is zero such languages can or will exist but with an approximately infinite error bar on that answer.
In theory, I don't see why not. For instance, you could have a language that is adapted for both the JVM, CLR and native and also cross-compiles to JavaScript.