Subj : Re: int8 for property enum? To : Brian Genisio From : Brendan Eich Date : Mon Feb 02 2004 01:25 pm Brian Genisio wrote: > Hi all, > > Please tell me if I have a misunderstanding here... it seems I must. > (using spidermonkey) > > When I create an object type in javascript, I create a handful of > properties, and register them using the JSPropertySpec type. In this > type, the unique ID is defined as int8, which can have a value of -127 > to 127. > > So, this means that I have a limit of 256 properties for a given > object. What if I want more? The reason this seems a bit > restrictive, is because of delegation and the [] operator. It's just a tinyid restriction. There's no law that says you have to use tinyids, that is, use JS_DefineProperties or JS_DefinePropertyWithTinyId. You can use JS_Define{,UC}{Property,Element} freely. Why tinyids, anyway? They exist so you can have a class getter or setter, or even a getter/setter shared among a set of properties, and you want the common getter/setter to switch on an int id of some sort. That's what tinyids are for; they make for dense switches, and generally you don't need anywhere near more than a hundred or so well-known properties per built-in object class. The API is bigger than any one of its parts -- look nearby. /be .