A few questions and suggestions.

Michael Greenberg michael.m.greenberg at gmail.com
Mon Apr 30 10:52:14 PDT 2007


On 4/30/07, Peter Hall <peter.hall at memorphic.com> wrote:
> > > Even better would be to return some source that just invoked the same
> > > function. For example, eval.toSource() would return "/* native
> > > function */ return eval(str);":
> > >
> > > Then you could eval it, as you describe, and not only would it not
> > > throw an error but it would run as expected too...
> >
> > You can't eval a return statement or any such statement illegal in
> > the top level of a Program (the non-terminal goal for the grammar
> > that eval parses).

Which is why you'd want it to return:

function () { /* native function */ return eval.apply(this, arguments); }

or some such.

Mike



More information about the Es4-discuss mailing list