Subj : Re: finilize & construct: call disbalance To : anton muhin From : Brendan Eich Date : Thu Jul 15 2004 10:18 am anton muhin wrote: > Ok, maybe I should be more specific. I want to extend js with one class > --- RGB color plus a couple of utilities (it's actually VRML SFColor > class). Each instance has color values and, therefore, all the methods > can operate on it. However, I don't see any reasonable values for colors > that prototype object should have. Of course, I can default to something > like .0, .0, .0. Black seems a fine default color. > By now I ended with checking of private data presence, but I still don't > think that it's an ideal solution. So construct the prototype and you can eliminate the null checks. Be aware that your class getProperty and setProperty hooks could be called on an object of a different class, so you should use JS_GetInstancePrivate and null-defend there too. /be .