The name of the function set through Function::SetName() is only used for
information. The name is used when printing the function using toString(),
in stack-traces, in debugger and in profiling. The JavaScript scope where
the function not bound is not affected. It is like the following JavaScript:
a = function b(){}
Property a is a function with name b, a.name === 'b', and property b is not
defined.
Regards,
Søren
On Tue, Nov 10, 2009 at 22:07, Stephan Beal <[email protected]> wrote:
>
> Hello, v8'ers!
>
> These are largely hypothetical questions, but now i'm very curious...
>
> If i use Function::SetName() to name, e.g., all of my C++-side-created
> Functions "anonymous" (or anything else, e.g. for debugging purposes),
> are there any sort of name collision issues if they're created in same
> JS scope? That is, if i give 3 C++-created Function objects the same
> name (using SetName(), as opposed to assigning a property with that
> name), do i still have 3 independent functions?
>
> And are these names visible to code run in that JS scope? i.e. i
> create a Function in C++, use SetName("foo"), and then call "foo()"
> from JS code a moment later. What should i expect to happen here? i
> believe i should expect "foo is defined" unless i explicitly set the
> "foo" property of my current object to that Function. Is that correct?
>
> For that matter: does SetName() have any effect in JS space, or is it
> informational only?
>
> :-?
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---