[heycam/webidl] Make [SameObject] beneficial (#212)

I believe the contract with [SameObject] is supposed to be that whatever is returned the first time cannot ever change, right?

Currently specifications have to maintain that invariant and add the [SameObject] extended attribute as documentation.

However, what IDL could do instead is to allocate an internal slot when such an attribute is used. IDL's algorithm for the getter could then be to return the value from the internal slot when it's set, and when it's unset run the specification algorithm to get a value, set the internal slot to that value, and return that value.

That way the specification does not have to define how the value is stored, just how it's computed/retrieved.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/212

Received on Thursday, 27 October 2016 11:34:18 UTC