Andy, with your CL (https://codereview.chromium.org/459413002/) we can use Symbols as property keys. I thought the following code worked, but doesn't.
v8::Local<v8::FunctionTemplate> foo = v8::FunctionTemplate::New(isolate); v8::Local<v8::Name> name = v8::Symbol::New(isolate); foo->PrototypeTemplate()->Set(name, v8::FunctionTemplate::New(isolate)); v8::Local<v8::Object> new_instance = foo->InstanceTemplate()->NewInstance(); CHECK(!new_instance.IsEmpty()); CHECK(new_instance->Has(name)); The code fails because new_instance is empty. Am I missing something? Thanks, On Tue, Aug 19, 2014 at 10:18 AM, Yutaka Hirano <[email protected]> wrote: > Thank you for your comments. > > > On Mon, Aug 18, 2014 at 11:06 PM, 'Erik Arvidsson' via v8-users < > [email protected]> wrote: > >> Right now we have v8::Symbol::For and v8::Symbol::ForApi. However, >> Symbol.iterator uses %SymbolRegistry().for_intern >> >> >> https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/symbol.js&l=44 >> >> We should probably add a ForIntern here as well: >> >> >> https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/api.cc&l=6148 >> >> >> On Mon, Aug 18, 2014 at 5:16 AM, Andy Wingo <[email protected]> wrote: >> >>> On Mon 18 Aug 2014 09:35, Yutaka Hirano <[email protected]> writes: >>> >>> > I'm planning to implement part of WebMIDI API[1] in Blink and want to >>> > return iterable objects from some functions. In order to do so, I need >>> > to access Symbol.iterator from the C++ world. IIUC currently there is >>> no >>> > way to do so (except evaluating "Symbol.iterator"), right? >>> > Can I add v8::Symbol::iterator? >>> > >>> > 1: http://webaudio.github.io/web-midi-api/ >>> >>> We'll be landing support for symbols in the API shortly >>> (https://codereview.chromium.org/459413002/, >>> https://codereview.chromium.org/467013003/). I am not sure what the API >>> should look like for getting well-known symbols; I suppose >>> v8::Symbol::iterator() could make sense, but I don't know. >>> >>> Andy >>> >>> -- >>> -- >>> v8-users mailing list >>> [email protected] >>> http://groups.google.com/group/v8-users >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "v8-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> erik >> >> >> -- >> -- >> v8-users mailing list >> [email protected] >> http://groups.google.com/group/v8-users >> --- >> You received this message because you are subscribed to the Google Groups >> "v8-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
