3 ms·
I have a different observation. This VM is meant to match Python semantics, including support for keyword arguments with defaults, lexical scope, and exception
by dalke 10y ago
I have a different observation.
This VM is meant to match Python semantics, including support for keyword arguments with defaults, lexical scope, and exceptions. Neither the original McCarthy Lisp description which qwertyuiop924 praised, nor first Lisp implementation by Russell, supported those features. The latter two features came with Lisp 1.5, whose implementations are much larger than 500 lines. http://www.softwarepreservation.org/projects/LISP http://www.softwarepreservation.org/projects/LISP .
And that's okay - a language doesn't require those features. And a language without them, like Forth, can be much more compact as a result.
- nickpsecurity 10y agoI was curious so looked up McCarthy's paper. Appendix B has code and pseudo code for minimal interpreter. Takes one page. Primitives are easy to code, too. It would surpise me if that took much larger than 500loc to implement.
- qwertyuiop924 10y agoLexical scope, in particular, is very easy to implement. Call/cc or exceptions are a bit tougher, but it can be done. And all defaults take is a bit of extension to the lambda. In fact, defaults can be added atop the language with a macros, as can keyword arguments. Macro expanders are a bit harder to write than the functionality itself, however. Especially if you want a good one.
- qwertyuiop924 10y agoI wasn't intending to praise it, just show that other languages did similar things more elegantly. Also, in case you weren't reading carefully, I also pointed to Scheme's metacircular evaluator, which implements lexical scope, continuations (of which exceptions are a subset), and can implement defaults with relatively simple extension.