7 ms·
Macros are important, that's why I seeking guidance in Let Over Lambda. The most suitable lisps for writing macros are lisp-2, hence the preference for a lisp-2
by devijvers 16y ago
Macros are important, that's why I seeking guidance in Let Over Lambda. The most suitable lisps for writing macros are lisp-2, hence the preference for a lisp-2 dual namespace.
- pwpwp 16y agoLisp-2's have less potential for trouble with unhygienic macros, but they still have it. Hygienic macro systems work with Lisp-1 as well as with Lisp-2. Apropos, I've written a Lisp->JS compiler a while ago; you might find some of the code useful: http://github.com/manuel/cyberlisp/ http://github.com/manuel/cyberlisp/
- DTrejo 16y agoYou might also check out the Racket->JS compiler: http://planet.plt-scheme.org/display.ss?package=moby.plt&owner=dyoo http://planet.plt-scheme.org/display.ss?package=moby.plt&... I used it just last year — the developer, dyoo, is super responsive. I'm sure he'd be happy to talk shop with you: http://github.com/dyoo/moby-scheme http://github.com/dyoo/moby-scheme
- sedachv 16y agoIn regards to hygienic macros and Hoyte's Let Over Lambda, the type of variable capture hygiene is designed to prevent is actually used as a programming technique in the book; Hoyte calls it free variable injection. Lisp-1 vs Lisp-2 actually has very little to do with macros. Most of the inconvenience comes when writing functions - things like having to name list parameters "lst." The way Common Lisp gets around the variable capture problem is to forbid the rebinding of special forms, functions, and macros defined in the standard.* This is an ugly hack that forces early binding, and obviously does nothing to prevent capture of user-defined functions. The Scheme wiki has a good article on hygiene: http://community.schemewiki.org/?hygiene-versus-gensym http://community.schemewiki.org/?hygiene-versus-gensym * - This wasn't done for the sake of macros. The rationale behind the decision as I heard it is to prevent the hypothetical scenario of some standard function like cdr that's called inside the garbage collector or allocator from being rebound to something that tries to allocate memory and crashes the gc or sends the allocator into an infinite loop. I don't really buy it; it's easy enough to prevent these types of scenarios.
- sreque 16y agoI think the Scheme and Racket communities would take issue with your claim that lisp-2 languages are more suitable for writing macros than their respective languages :)