Subj : Re: Private Data and Prototype Inheritance To : netscape.public.mozilla.jseng From : "Kevin Lindsey" Date : Sat Jan 10 2004 10:26 am Brendan Eich wrote: > > Is there a idiom or recommended way of converting to and from jsvals and > > pointers? > > 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). Ah yes. I should have caught that from the docs. It's too easy to miss things when just getting started. Thanks! > But again, can you avoid using private data structs altogether and just store the > members of the struct as discrete properties? Well, yes and no. I am scripting a 2D animation/rendering engine. It is cleaner and faster for me to keep state information for each graphics element in native C structures as the image will need to be redrawn roughly 30 times a second. I am currently experimenting with where to place the divide between how much is done in C and how much is done in JS. It would be extremely cool to me if I could write the majority of my high-level rendering and animation logic in JS, but I don't think that is realistic. Experimentation will tell. Thanks again for all of your help. Kevin .