> >> We could even allow for direct proxies to acquire non-standard internal >> properties from their target object. This could be a useful principle when >> wrapping host objects. > > This seems important in order to make host methods work, e.g., the ones that > access the [[Value]] property. I guess you could code around it by proxying > those methods as well? > > What's the [[Value]] property? I'm not sure I understand.
Er, sorry, [[PrimitiveValue]]. (It was called [[Value]] in Edition 3.) Section 8.6.2, Table 9. > But I have some serious reservations about it. For one, tying the notion of > "becomeability" to extensibility seems sub-optimal. I'm not sure you always > want an object to be non-extensible when you want it to be non-becomeable. > And a serious practical issue is whether host objects could be becomeable. > I'm pretty sure that's going to be a serious problem for implementations. > > I agree in principle that "attachability" or "becomeability" is distinct from > extensibility. But from a usability POV, what's the alternative? To introduce > yet another bit, and to put the onus on defensive objects by requiring them > to do Object.freeze(Object.cantTrap(myObject))? To me, that seems worse than > tying non-extensibility to non-becomeability. One alternative is not to include Proxy.attach. :) But I need to think about this more; I'm not sure those are the only options. Maybe they are. You've had more time to think about this than I have. :) >> It’s still as easy to create such “virtual” proxies: just pass a fresh empty >> object (or perhaps even null?) > > Please, make it null. So much more pleasant (and avoids needless allocation). > > (The only downside of allowing null to mean "no target" would be if you > wanted to future-proof for virtualizable primitives, including a > virtualizable null.) > > Avoiding needless allocation is why I proposed null, indeed. But there are > some unresolved issues here: if the target is null, how should the proxy > determine its typeof, [[Class]] and [[Prototype]]? "object", "Object", and null. :) > This needs more thought. Sure, I can believe that. But as long as there are reasonable defaults for all these things, I would much prefer to allow null. > IMHO, if we would buy into direct proxies, I see no need to continue > supporting Proxy.create{Function}. Agreed. Dave
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss