Quasis: assignable substitutions?

Axel Rauschmayer axel at rauschma.de
Fri Jun 17 04:18:45 PDT 2011


>>> and redefines the SVE of ${=x.y} to be
>>> 
>>>     function () { return arguments.length ? (x.y = arguments[0]) : x.y }
>>> 
>>> so instead of passing substitution values, for read-only substitutions
>>> (those without the = modifier) you get a thunk, and for writable
>>> substitutions you get a function that returns the value when called
>>> with 0 arguments or assigns the first parameter if passed one.
> 
> It also allows for multiple evaluation of substitutions which might be
> useful for looping constructs in the template use-case.


Yes, useful. I assume that if the expression is not assignable, trying to use the function as a setter will produce an exception(?)

-- 
Dr. Axel Rauschmayer

axel at rauschma.de
twitter.com/rauschma

home: rauschma.de
blog: 2ality.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110617/35cbfb16/attachment.html>


More information about the es-discuss mailing list