Lambda the Ultimate

inactiveTopic Polyglot Programming
started 10/9/2002; 9:43:53 AM - last post 10/17/2002; 1:58:11 AM
Dan Shappir - Polyglot Programming  blueArrow
10/9/2002; 9:43:53 AM (reads: 1971, responses: 5)
Polyglot Programming
What does it take to support several programming languages within one environment? .NET, which has taken language interoperability to new heights, shows that it's possible-but only with the right design, the right infrastructure, and appropriate effort of both compiler writers and programmers.

An article by Bertrand Meyer, first in a three-part series.

Note that registration (free) is required to read this article.

The more than 20 languages ported or in the process of being ported to .NET range from Cobol and Fortran to Smalltalk, Oberon, Eiffel, Java, Perl, Scheme and Python. How does this all work? Do languages have to sacrifice anything? Should we believe those who say that it's all smoke and mirrors, and that deep down, all languages get reduced to a common denominator, whether we call it C#, Visual Basic .NET, managed C++ (or Java)? These are some of the questions I'll examine in this three-part article.
Posted to cross-language-runtimes by Dan Shappir on 10/9/02; 9:50:50 AM

Luke Gorrie - Re: Polyglot Programming  blueArrow
10/10/2002; 3:28:09 AM (reads: 740, responses: 0)
Of course, the best way is to simply keep your code programming language independent, so you can run it with whichever language/compiler is available on your current project.

More programmers should follow the example of the second program at http://www.cuillin.demon.co.uk/nazz/trivia/hw/hw_multi.html, which performs the same whether run as COBOL, Pascal, Fortran, C, Postscript, Shell script, and x86 machine code.

Doug Ransom - Re: Polyglot Programming  blueArrow
10/10/2002; 8:17:13 AM (reads: 718, responses: 0)
Its one thing to "interoperate" at the language level, but it seems to me there is a huge semantic gap between the way data structures exist in functional languages and imperative languages.

Lazy programming and data structures build with lazy constructs facillitate programming with lenses, wires, and bannanas, and provide huge ability for programmers to do things more easily and quickly, with more success and perhaps more performance.

Unfortunatley, the impedence mismatch is just too high. ECMA CLR, for example, has a huge runtime library of lists (without even fold functions or any built in way to visit all members in a list the way the rogue wave tools.h++ or C++ standard template library do) built in the imperetive fashion -- no lazy lists.

So, there is hardly any point in interfacing these data structures to a functional language -- we still end up with entire temporary trees coming into existance. The ECMA CLI/CLR provides the instructions on the VM required for functional languages, but the object interfaces just aren't that interoperable. And the functional language compilers are not there.

http://www.geocities.com/dransomxxx/

Vlad S. - Re: Polyglot Programming  blueArrow
10/10/2002; 7:09:03 PM (reads: 691, responses: 1)
Not to flame or anything, but so far it all seems to work because of large cash grants from certain parties with vested interests. I have never met nor heard of anybody (aside from these programming rag typists) who is genuinely exited about the CLR. I went to a Microsoft rah-rah seminar on .Net (hey, they had free pizza!), and even the speaker downplayed the CLR a bit.

Hell, most people weren't even that exited about Java, and those that were, certainly aren't now. At my university, the only reason they teach it to incoming undergrads is because they can't wrap their heads around pointers and cleaning up their own garbage (apparently they got burned pretty badly when they decided to try C++ for a year.) I think Paul Graham is right when he says that the future of web apps is on the server through an html interface, and not with another "applet" gimmick.

The only other class of applications that needs portable binaries/"sandbox" VMs is videogames, to distribute add-ons with less redundancy, and to permit mods without the danger of trojan horses or the burden of open-source. But here memory requirements and the real-time nature of the work mean that most of these solutions are custom-written (John Carmack was considering using a JVM for Quake3, but later wrote his own VM.)

Dan Shappir - Re: Polyglot Programming  blueArrow
10/11/2002; 1:49:36 PM (reads: 678, responses: 0)
I have never met nor heard of anybody (aside from these programming rag typists) who is genuinely exited about the CLR

I would like to point out that Bertrand Meyer is not a programming rag typist. He is a Professor of Software Engineering at ETH in Zurich, Switzerland, and is an adjunct Professor at Monash University in Melbourne, Australia. He is also the initial designer of the Eiffel method and language and directed the development of the ISE Eiffel environment, compiler, tools and libraries. He is also involved with the implementation of Eiffel on .NET so I believe he is eminently qualified to write such an article.

At my university, the only reason they teach it to incoming undergrads is because they can't wrap their heads around pointers and cleaning up their own garbage (apparently they got burned pretty badly when they decided to try C++ for a year.)

Although C++ is my primary programming languages, and the fact that I generally like it more than Java (or C#, at least until they get generics), I believe that C++ is not a good choice for a first PL. There are probably better choices than Java, but Java IMO is better than C++ in this context. C++ is just too full of things that can bite a beginner in the arse and don't generally contribute to learning programming in general and OOP in particular.

I think Paul Graham is right when he says that the future of web apps is on the server through an html interface, and not with another "applet" gimmick.

I'm a DHTML/JavaScript aficionado (the JavaScript part at least should be well known on this forum by now), indeed I've designed and implemented application interfaces (as opposed to simple web pages) using them. Given this, I can truthfully say that this combo, though very powerful, has some significant limitations. In some cases a downloadable applet/control/application (such as the new downloadable WinForms components) can make life a lot easier both for the developer and the end-user.

Finally, despite my reservations about the viability of a truly cross-language general purpose library (such as the CLR), if it does work, it can provide significant benefits to PL developers. The issue of libraries can really pose a "chicken and egg" problem for new PLs. Usually a PL won't get powerful general purpose libraries until it becomes popular. OTOH it may not be able to become popular until it gets such libraries. Something like the CLR can act as springboard in such circumstances, allowing new PLs to leap over this hurdle.

jon fernquest - Re: Polyglot Programming  blueArrow
10/17/2002; 1:58:11 AM (reads: 568, responses: 0)
> So, there is hardly any point in interfacing these
> data structures to a functional language

It will be specific types of problems which functional languages have a comparative advantage in solving that will lead to their adoption under .NET .

"What can functional languages do better?"

Event handling in GUI interfaces,....

http://citeseer.nj.nec.com/elliott98declarative.html

"What can I do better with strong typing?"

Program seamlessly with typed XML data sources and sinks,....

Some people talk as if functional languages could usurp all of mainstream imperative and OO functionality immediately or serve as a substitute for the same functionality.

These are unreasonable expectations. There has to be a very clear advantage to be gained by rewriting code in a radically different paradigm. The trick is to find these advantages. (e.g. An Adobe Illustrator-like drawing program could probably be expressed very concisely, and formulaicly using the ideas in the paper above.)