On Fri, Oct 16, 2009 at 6:52 PM, Joe Strout <[email protected]> wrote: > > Kripken wrote: > > > Not a bug in V8, just an oddity of JavaScript. Run the same code in > > SpiderMonkey, for example, and you'll get the same results. > > > > Basically, you need to set constructors manually if you want to use them > > the way your code does. > > OK, but that's odd... somewhere internally there must be a reference > from each object to its prototype. We can see this in the way > properties are looked up. But, if we don't store it ourselves, there is > really no way to find out what that prototype is? > > Not that I'm aware of.
Generally speaking, frameworks for inheritance in JavaScript (e.g., http://ejohn.org/blog/simple-javascript-inheritance/ ) manually set the constructor, as part of whatever other setup they do, so that things work the way people expect. So people using those frameworks are shielded from this messiness in JavaScript. Thankfully it's fairly easy to do that, given JavaScript's dynamic nature. - kripken --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
