Re: [stack] Joy's relationship to FP + a Joy variant with combining forms
John Cowan <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
John Nowak scripsit: > What I'm desperately curious about is why certain languages like FP, > APL, J, etc, avoid first class functions. Obviously there are > advantages to only having first order functions, and I see a few ways > this is useful (termination proofs are much easier, etc), but I'm > admittedly less informed on this subject than I'd like to be. If > anyone would be willing to point me in the direction of something that > discusses the advantages of the FP/APJ/J approach in contrast to the > ML/Haskell approach, I'd be very grateful. Unfortunately, most papers > on FP seem to be locked away on sites I don't have access to, which is > doubly bad as there are so few to begin with. I don't really know either, but one thing that comes to mind is that these languages are classically implemented using dynamic-binding interpreters, which don't mix very well with first-class functions (the Lisp "funarg problem"). Although as long ago as 1977, HP implemented APL using a JIT compiler, with as far as I know no effects on the language except the loss of "eval". The paper describing it, (Eric J. Van Dyke, A Dynamic Incremental Compiler for an Interpretative Language, HP Journal, pp. 17-24, July 1977), is not online as far as I can tell, but in brief: Each line of APL code was compiled into machine code as it was encountered, specializing the code to assume that the rank, shape, and type of the variables mentioned in it were fixed. A prologue, also JIT-compiled, assured that this was still true when the line was next executed. If the assumption failed, the line was recompiled using a different strategy which assumed that rank and type were fixed but not shape; further failures caused this second strategy to be repeated. This technique squeezed almost all the polymorphism out of actual APL programs. -- Income tax, if I may be pardoned for saying so, John Cowan is a tax on income. --Lord Macnaghten (1901) [email protected]