name property for built-in functions??
david.hopwood at industrial-designers.co.uk
Mon Mar 9 02:09:47 PDT 2009
Allen Wirfs-Brock wrote:
> I have another concern about the potential interactions between the
> proposed name property and toString. Apparently, there is a known use
> case of eval'ing the result of toString'ing a function in order to create
> a new function. If we assign synthetic names such as "get_foo" or "set_foo"
> to syntactically defined getter/setter functions or allow a user to
> associate a name with an anonymous function which then appears in the
> toString representation will mean that eval will parse the toString result
> as a FunctionDeclaration rather than a FunctionExpression.
> For non-strict evals, that means that the synthetic name will get added
> to the Declaration Environment of the eval. Note that for indirect evals,
> the Declaration Environment is now the Global Environment but even for
> nested eval this possibility seems like a hazard that that most uses are
> not dealing with.
I don't see why this is an interaction between 'name' and 'toString'.
Isn't this issue independent of whether 'name' is present?
David-Sarah Hopwood ⚥
More information about the Es-discuss