A few questions and suggestions.
Jeff Walden
jwalden at MIT.EDU
Mon Apr 30 12:11:39 PDT 2007
Thiago Silva wrote:
> But, isn't this kindda odd? I mean, knowing what eval() do and what
> toSource() do, one assumes that they can (should?) be interoperable.
You also forget about cyclic structures. SpiderMonkey has sharp variables for this, but there's no concise ES3 way to serialize such structures. (You can hack it by constructing it in an evaluated closure in ES3, and let expressions provide a cleaner ES4 syntax, but it seems highly unlikely either will ever be spec-mandated.)
> I know that being unable to actually have a native source evaluated
> already breaks this consistency, but injecting an invalid syntax
> string in it's source seems too much to me.
Just so you know, SpiderMonkey already injects invalid syntax into the generated string for a native method:
js> Array.prototype.push.toSource()
function push() {[native code]}
Jeff
--
Rediscover the Web!
http://snurl.com/get_firefox
Reclaim Your Inbox!
http://snurl.com/get_thunderbird
More information about the Es4-discuss
mailing list