Subj : Re: Pairs of 32-bit pointers To : Sterling Bates From : Brendan Eich Date : Sat Dec 06 2003 08:19 pm Sterling Bates wrote: >I'm wondering if this has been considered already (very likely), or if it is >up for consideration. I think there are two places this could be >advantageous. > >The first is storing the data type of a variable in the first pointer, with >the variable's contents in the second. This would avoid modifying the >actual variable (or pointer to it) itself. > > I have no idea what you mean here. Could you give an example? Some context? A use-case? Thanks. >The second is function callback. Delphi (and possibly C++, but I don't >know) > Not C++, unless you make a method pointer explicitly. > stores two pointers for every object method: one to the code, and one >to "this" or "self". By permitting a method pointer as a callback, >developers could point directly to the object instance that expects the call >instead of a call wrapper. The private slot is not always available, or >sometimes just not a good idea, for this. > It's not relevant. > JSString, for instance, uses its >private slot for its own data. This prevents a developer from using that >slot for an external object reference. (Granted, that's likely a rare >occurrence with JSStrings, but it highlights the point.) > > Hard cases make bad law. Usurping private to make a bound string method reference is wrong. Use JSFUN_BOUND_METHOD and the parent slot. /be >Just curious, > >Sterling > > > > .