best superset language...

if one had to pick one language to write a program that would then be translated into any other language at random, what would be the best language to pick.
(obviously not all conversions could be done efficiently !)

Obviously as a c++ programmer i'm asking this with various dividing lines in mind.. pure vs impure functional, garbage-collection vs manual, static vs dynamic types.

maybe the question is nonsensical but i'm sure this forum will have interesting insights. :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Forth

You can easily write Forth in any language, and it isn't a Turing tarpit like a variety of other languages about which you could make the same claim.

But I'll note that this seems to be a "subset" language you've requested. I.e. you ask for a language whose programs are elements (or easily translated into elements) of any other language at random. A "superset" language would, I think, be one that has programs that, for almost any other given language, you'll be missing something to implement it. Common Lisp and Oz/Mozart and Alice would each get votes, there.

Or were you asking about automated translation / compilation?

I see you're taking Ehud's April 1 post to heart, ceti311. You're new here. I'm going to suggest you take some time to peruse site policy regarding use of real names and appropriate topics.

I think you were right that

I think you were right that the question is nonsensical. You haven't defined what you mean by "best."

put it another way, if you

put it another way,
if you wanted to pick a language to learn to prepare for a functional language future, what would it be...

That's another way of

That's another way of putting the opening? I'm having difficulty seeing how a question about "preparing for a functional language future" and "good superset language" would be related.

So, you wish to know which language to learn in order to prepare for a functional language future.

I'd suggest Haskell. Mercury language would also be a good choice.

I say 'superset' and

I say 'superset' and 'functional language future' since I'm thinking about parallelism and obviously all the buzz is around 'functional programming' .... yet the *present* remains firmly C++ working on game-consoles, due to the complex low-level issues.

To my knowledge, you couldn't use Haskell to drive Cell SPUs (???)

If you wanted to start writing a software renderer for Larabee, you'd use C++ as opposed to waiting for the language of the future, right?

I see you did mention Lisp;
I was always fascinated by what Naughty Dog did with GOAL years ago on the PS2; so there they had Lisp solving BOTH low level instruction set issues AND gameplay-scripting, maybe behaving like the 'superset' language i was trying to get at?

I don't know so many details about this though; maybe again people on this forum would know more.

Maybe it was only a subset of lisp with so many specific extensions as to not be Lisp any more.

Maybe it's a failed evolutionary branch (I'm surprised something similar didn't appear on PS3, maybe there are very good reasons for that)

Maybe some obscure language I've never heard of could do what they were trying to do better.

Maybe c++0x will be a big step forward as it will be possible to write the sort of external iterator type code that would look more like functional languages. (e.g. iterators taking predicate functions instead of using 'if' statements which one could translate more readily into branchless-unrolled-SIMD loops..)

game consoles?

I'm not sure game consoles should have much if any influence on what you should learn and what languages are popular. Indeed, the present in the gamedev world is firmly in C++ not due to some technical benefit, but sheer unadulterated momentum.

Anyways, Tim Sweeney of Epic/Unreal fame has a relatively well known talk about programming languages you might be interested in.

I'm in the games industry.

I'm in the games industry. I've read the Tim Sweeney talk now, absolutely fascinating. (i'd heard of his overall statement before)
It will be interesting to see if another language does appear as he seems to want, or if c++0x sufficiently patches over it's shortcomings.

From the perspective of my immiediate real-world, using anything other than c++ for serious programming is an alien concept. Scripting languages have been used but a more common approach is artists'tools producing data-driven logic (i.e. interpreters written in c++ for graphically edited domain-specific-languages)

obviously having seen these (and past/future ideas- GOAL, TimSweeney talk) one obviously asks if one could solve all these problems in one place.
[e.g. the artists' tool would edit source code behind the scenes]

Could one language represent *everything* (including job spec for spus), ... and have a mixture of conversion to C++ for compiled engine + dynamically loaded interpreted portions.
.. and rather than devising a language from scratch, what already exists that could handle all this.
.. or would one extend c++ -some bits of custom syntax stuck in there with code preprocessors/generators (safer evolutionary path..)

What i've seen:-
-obviously core app&engine c++, with useage of intrinsics to a level that approaches assembler, typically maintain 'unopt'/'opt' versions side by side, yet you can really tell expressing things with 'map' 'filter' etc would make things much clearer.
-hlsl
-binding for hlsl-to-core-engine - "FX-files" - specific syntax deals with exposing game-variables to shaders (declarative?)
-UI - bits of LUA + graphical node-chart
-sound-language - XML thing looking a lot like lisp
-level-logic - message passing, + lots of manually written glue interfacing c++
-animation-constraints (==functional language set up in maya, tool must map to parallelizeable batches for simd/ILP)
-ai/character state machines

A complete mess :)

If you're in the industry

Then you should know that it's practically moot. Compiler support for consoles is terrible, and it's not financially viable to spend a bunch of time making a compiler instead of a product.

That said, I've seen some ideas floating around the gamedev.net forums that involve languages similar to scala. The idea is that scala-like languages allow for DSL creation within the native language to help bridge some of those gaps. Not that those will solve the compiler support issue on consoles or the social problem with the industry's stubborn adherence to C/C++, but...

yes. this is appeared to be

yes.

this is appeared to be a forum r.e. theoretical discussion on languages. hence the place to discuss such ideas.

moot for an industry worker, but surely an area for a lot of potential academic research / future innovation.

cue felix

i always hope some big users of C++ will get behind Felix, to give it some more motion.

If I may ask...

What language are you currently using?

To my knowledge, you

To my knowledge, you couldn't use Haskell to drive Cell SPUs

Coconut is a developing system for high-assurance, high-performance
software. It was used to develop a library of special functions for
the Cell BE processor, which is distributed in the Cell BE SDK 3.0 as
MASS. Average performance is 4X better than the alternative
hand-tuned C library, SimdMath.

Coconut has been successful where patterns of efficient
hardware-specific computation can be captured as higher-order
functions and encoded in a Domain Specific Language embedded in
Haskell. Patterns include efficient control structures not
expressible in C, e.g., the MultiLoop, and efficient uses of SIMD
instructions which require significant compile-time computation for
pattern specialization. Some patterns interact with a novel
instruction scheduler called Explicitly Staged Software Pipelining,
based on a min-cut approach, which outperforms SWING modulo scheduling
in our tests.

http://www.youtube.com/watch?v=yHd0u6zuWdw

Wow ! thanks so i'm on the

Wow ! thanks
so i'm on the right forum, asking the right questions after all :)

CELL has such bad press re programming complexity,
but i'm sure it's dma approach is the right way to go, and it demands new programming tools.
[similarly it's got to be better than the mess of GPGPU!]

How about joining the

How about joining the functional programming present?

It depends. For business,

It depends. For business, Scala. For machine learning and AI, Clojure.

If you don't know much about functional programming, then the key to getting started isn't the language but rather the content of the material you will be learning. Check out the Getting Started link on the left sidebar of this page.

Best algorithmic language?

Language translation is a tricky (black art) business. Having attempted to translate quite a bit of code, my opinionated conclusion would be that Standard ML is the best language to start from. The best evidence I could give would be Purely Functional Data Structures. It was a fairly mechanical translation to Oz (and has been translated to many other languages). The author cites signatures as the main motivation for using SML - they provide an explicit map for translation.