5 ms·
John Shutt's Kernel language [1], decomposes lambda into unevaluated operands, a lexical environment, and the function body: '(λ args body) can be express
by guns 14y ago
John Shutt's Kernel language [1], decomposes lambda into unevaluated operands, a lexical environment, and the function body:
'(λ args body)
can be expressed as:
($vau args env body) [2]
Interestingly, because $vau does not evaluate `args` and explicitly recieves a lexical binding, macros are not necessary in Kernel, and hygiene is a simple matter of (eval)ing with the right environment.
Arguably then, Kernel is more fundamental than Lisp.
[1]: http://web.cs.wpi.edu/~jshutt/kernel.html http://web.cs.wpi.edu/~jshutt/kernel.html
[2]: Manuel Simoni has a short overview of $vau here:
http://axisofeval.blogspot.com/2012/03/i-want-to-understand-vau.html http://axisofeval.blogspot.com/2012/03/i-want-to-understand-...
- akkartik 14y agoI think you mean to say that Kernel doesn't need to implement macros because they can be built using $vau. --- Besides that, I think you're overstating its significance. a) Maxwell's equations don't claim to be 'most fundamental'. They are a concise basis set for a space of problems. They occupy a memetic sweet spot; abstractions both above and below them are more verbose. The metacircular interpreter of Kernel can't compete with McCarthy's version. b) Any language with fexprs is 'as fundamental' as Kernel. Including LISP 1. c) In its search for hygiene Kernel eliminates quote. Scheme folks will likely find this a useful tradeoff, while common lisp folks with their backquoted macros will shudder. In kernel you 'create macros' by explicitly consing code.
- guns 14y agoI concede your point about Maxwell's equations. Their historical significance in particular is the unbelievably rich research that ensued from its implications. By this metric, Lisp is obviously the analogue in the programming world. It would have been nice though if Lisp had triggered a sudden paradigm shift instead of this painful 50 year burn we're living through.
- gruseom 14y agoWe're still early in the game. 50 years feels like a long time to an individual human but historically it's just a start.
- pwpwp 14y ago"The metacircular interpreter of Kernel can't compete with McCarthy's version." First, it doesn't cover macros, while Kernel subsumes functions and hygienic macros with a single construct. Second, I don't think a toy version of a Kernel metacircular evaluator would be much more complex than the toy McCarthy evaluator. "Any language with fexprs is 'as fundamental' as Kernel. Including LISP 1." Only if said language is lexically scoped, and fexprs receive the lexical environment in which they are called as parameter, as in Kernel. Otherwise you'll miss hygiene.
- akkartik 14y agoYeah I'd like to see a toy version of a Kernel metacircular interpreter. Maybe it's just me, but I don't consider 'better supports hygiene' to imply 'more fundamental'. It doesn't add new capabilities. It merely prevents certain kinds of errors.
- lispm 14y agoThat beams you right back to the 1960s where FEXPRs were common in Lisp. They died a slow and horrible death at the end of the 70s under the influence of Scheme and Maclisp.
- akkartik 14y agoKernel makes the point that much of the vilification of fexprs was actually caused by dynamic scope. Combining them with lexical scope makes for a surprisingly reasonable language.
- lispm 14y agoThat were not the arguments of Pitman.
- akkartik 14y agoHence the use of the word 'actually'. I recommend shutt's thesis.
- lispm 14y agoI recommend Pitmans actual critique of FEXPRs.
- akkartik 14y agoHere's the article he's referring to: http://www.nhplace.com/kent/Papers/Special-Forms.html http://www.nhplace.com/kent/Papers/Special-Forms.html Here's a discussion on LtU about Pitman-vs-Kernel: http://lambda-the-ultimate.org/node/3640 http://lambda-the-ultimate.org/node/3640
- lispm 14y agoIf you read Pitman's paper, you can read that his critique is not so much about theoretical issues of interaction of dynamic binding, but about practical issues. Pitman was somebody who wrote and used lots of Lisp code which was used by users (for example Macsyma). Dynamic binding was a side issue - practical compilability a much bigger issue.
- pwpwp 14y ago(lambda args body) is not the same as ($vau args env body), because the latter doesn't evaluate its operands. Lambda in Kernel is defined as follows: ($define! $lambda ($vau (formals . body) env (wrap (eval (list* $vau formals #ignore body) env)))) When you say ($lambda (x) x), a new fexpr (that ignores the environment in which it is called, because lambdas don't need it) is constructed -- ($vau (x) #ignore x) -- and then it is wrapped, so that its operands are evaluated. So, (lambda args body) can be expressed as (wrap ($vau args #ignore body))