Subj : Re: Private Data and Prototype Inheritance To : Kevin Lindsey From : Brendan Eich Date : Fri Jan 09 2004 05:56 pm Kevin Lindsey wrote: >>Alternatively, you could avoid private data and use property storage. >>Then delegation works as usual. > > Ah, OK. So, I would setProperty my private data in the native base class' > constructor. Then, using Line.apply(this, arguments), the derived object > will get its own version of the "private data" property. That makes sense. I actually wondered why you need a private data structure, instead of just x, y, etc. properties that store numbers. > Is there a idiom or recommended way of converting to and from jsvals and > pointers? It seems that I would have to use a jsdouble or string since ints > are shifted internally. JSVAL_TO_PRIVATE and PRIVATE_TO_JSVAL, to hide the otherwise-potentially-object-like private data struct address from the GC (the address must be 0 mod 2). But again, can you avoid using private data structs altogether and just store the members of the struct as discrete properties? /be .