[parenscript-devel] What's up with let

Travis Cross tc at travislists.com
Sun Aug 17 10:26:03 UTC 2008


Daniel Gackle wrote:
> First, the semantics of let have changed to be more Lisp-like. Is that 
> correct? This causes some practical problems. In much of our app, 
> performance is critical and we can't afford to have temporary variable 
> reassignment, try/finally, and delete magic going on under the hood. 
> What we need is plain-old, naked Javascript variable assignment - the 
> simplest generated code possible. As of 20071104, that's exactly what PS 
> generated for let. Now, it generates code that's considerably more 
> complex, which we mostly can't use.
> 
> My questions are: (1) Does anyone need Lispy let, or can we just take it 
> out and revert to the simpler let? (2) If it really is needed, can we 
> come up with an easy way to offer the user their choice of assignment 
> semantics (perhaps a special variable)?

The semantics of LET (and DO) did change to be more lisp-like.  At the 
same time, LET* and DO* were introduced for access to more native JS 
semantics.

The idea is that PS feels pretty close to lisp in other ways, so the 
expected semantics of CL:LET should be broken as little as possible when 
there already exists a CL construct that better matches native JS 
semantics: LET*.  When writing PS, I use LET* most of the time for the 
same reasons you outlined above.  I still prefer having that * there as 
a visual reminder of what is really going on.

Is this change still going to be a huge issue for you now that you know 
we introduced LET*?  It seems that if you want LET*-like semantics 
everywhere in your existing code, you just need to search/replace all of 
your LETs into LET*s (or, alternatively, locally bind PS:LET to PS:LET*).

Cheers,

-- Travis



More information about the parenscript-devel mailing list