An alternative quasi-literal strawman
ash_js at firemirror.com
Thu Dec 31 06:13:33 PST 2009
On 31 Dec 2009, at 06:12, Mike Samuel wrote:
> I received some convincing arguments that the original quasi proposal
> fell short as a DSL scheme. Whether a full-fledged DSL scheme is
> desired or not, I don't know, but I read up on scheme macros and put
> together an alternative semantics that I hope gets the strengths in
> flexibility and performance of scheme macros while preserving the
> encapsulation and security goals of SES, and having a syntax that
> should be familiar to PHP and perl users.
> It is a significantly more complex proposal so I broke the semantics
> into three sections: free variable analysis, alpha-renaming, and
> hygienic macros, and put together a draft implementation of each.
> The alternative proposal is at
> http://wiki.ecmascript.org/doku.php?id=strawman:quasis-alt and that
> page links to the two supporting documents. At the top of each are
> links to source code and tests.
> Even if the extra complexity is prohibitive, hopefully this
> demonstrates that the original proposal can be extended in the future
> should DSL support in ecmascript become a desideratum.
What's with |(0, eval)('hygienicMacro')| for in all the examples? It just serves to confuse me
Why does hygeienicMacro need the qfnName? Wouldn't that be qfn.name if it matters? If not then perhaps move it to the last argument, as I don't think it would be used all that often.
(Just as an aside at this point, you have #Substitutions and a few others which don' link anywhere on this page)
'Quasis maintain isolation' - doens't this just make it behave like a function with different syntax than a macro? Oh no i just read it wrong, and somehow from the ten steps got the impression that it could access variables from the scope where the macro substitution occurs. Hmm wonder why..
deterministicAfterFirstCallJsonToJsonFn is just a form of memoization isn't it? Also |var args = Array.slice(arguments)| (yes, that is using the array generics on the ctor. I like them)
In general as a language user rather than as somehow who might have to implement this (which I'm not, I am *just* a user) I think I like the more power this gives me, but its a very limited form of DSLs with slightly peculiar syntax. In short I like the idea, but I don't get this proposal :(
Even more generally I'm still unconvinced by the escaping rules.
More information about the es-discuss