W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2013

RE: JSIDL ideas for read only (Was: RE: Figuring out easier readonly interfaces)

From: Domenic Denicola <domenic@domenicdenicola.com>
Date: Thu, 3 Oct 2013 12:17:02 +0000
To: Boris Zbarsky <bzbarsky@MIT.EDU>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <B4AE8F4E86E26C47AC407D49872F6F9F9B266399@BY2PRD0510MB354.namprd05.prod.outlook.com>
From: Boris Zbarsky [mailto:bzbarsky@MIT.EDU] 

> This is the general goal, yes.  But what actually happens here?  What actual prototype chain does that produce?  For example, what is the getter for the "x" own property of MutablePoint.prototype, if any?

Sure. The complete desugaring is similar to [1]. That is, the prototype chain is the same as produced by the corresponding JS class declarations, namely null -> Object.prototype -> Point.prototype -> MutablePoint.prototype. And the getter goes and gets the corresponding `x` out of a weak map (i.e. `return privates.get(this).x` using the desugaring of [1]).

A brand check might be necessary for the getters too to make this sound; I'd prefer to avoid that, as it seems unlike what you would write normally, but I can easily imagine that when I think about this harder, it'll be necessary for the general case. And now that I think about it, a brand check would produce a more informative error than trying to get property `x` of `undefined` if `privates.get(this)` did not exist.

Just to be more helpful, I've done the complete desugaring, with branding for both sides, in [2].

>> [1]: https://gist.github.com/domenic/6736258

[2]: https://gist.github.com/domenic/6808845
Received on Thursday, 3 October 2013 12:17:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:18 UTC