A Foreign object is *not* a JavaScript object it is intended to be used only internally. Furthermore, v8's GC needs to distinguish the objects under its control from the external ones, so we can't simply put any void* into an internal field. Currently this part of the API is in a poor and slightly broken state and there have been some discusssions how to fix it. The probable future API looks like this:
* A SetAlignedPointerInInternalField/GetAlignedPointerFromInternalField will be added, allowing highly efficient stores/loads of 2-byte-aligned void* to/from internal fields. * External will be changed back again to provide a real JavaScript object, namely one with a hidden field containing a Foreign. This way *any* void* can be wrapped and stored/loaded via SetInternalField/GetInternalField and IsExternal will work again. Wrap, Unwrap, SetPointerInInternalField and GetPointerFromInternalField will probably be deprecated and die in some not-to-far future. -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
