In particular, it seems that I often want a program to do 6 different things, and the best way to do 1 and 2 seems to be Lisp, 3 and 4 is in C, 5 is in Prolog, and 6 seems to be assembly language. I've given up on the QuestForThePerfect Language—why can't I just PickTheRightToolFor TheJob for each part, then glom together all the pieces?
I touched briefly on this topic a few months ago but went off into a different direction. It wasn't until a few days ago when reading The New UCI Lisp Manual (I enjoy reading old software manuals) which had a section on calling PDP-10 assembly langauge from Lisp (and vice-versa) that I recalled the above snippet and found myself once again with the thought of Where did we go wrong? Why can't we do this?
As I wrote then:
The module header contains a value specifying the language type, with values defined for data only, 6809 machine code, BASIC09-I-code, Pascal I- code and COBOL I-code. In theory then, you can construct, say, a pay roll system using a Fortran compiler to generate the math routines into 6809 code, COBOL to generate the business rules, and allow extentions to be written in BASIC. The language type is probably there for two reasons; 1) to know how to run the module, and 2) to figure out what parameter passing conventions to use (if there are any differences between the languages).
It really just comes down to calling conventions and making small enough pieces to link together.
Okay, so maybe it's not that simple. I'm having a hard time seeing how one would mix, say, Perl (with wealth of modules), Ruby (for easy integration with the World Wide Web) and Lisp (hey, if it's good enough for Yahoo Stores, then why not—it certainly beats using COBOL for business logic) into a single coherent program.
But even just thinking about that I can see why it might not be such a good idea after all—the three languages I mentioned are interpreted (even if it's “compiled” into an internal representation, it's just “compiled” into a form that's easier to interpret) with their own internal structure, and each are garbage collected (which means, memory is reclaimed automatically) but it's a safe bet that memory allocated by a Ruby routine can't be freed by a Perl routine (or Bad Things™ may happen), which is why it's not that simple.