Re: Exposing constructors of readonly interfaces to web authors

On Mon, Jun 30, 2014 at 1:44 PM, Domenic Denicola <
domenic@domenicdenicola.com> wrote:

> Not necessarily. The important invariant is `quad.bounds === quad.bounds`.
> It is not important that:
>

> var b1 = quad.bounds;
> doAnythingAtAll();
> var b2 = quad.bounds;
> assert(b1 === b2); // this does NOT have to hold.
>

It seems to me that it is simpler, more predictable and more efficient to
have b1 === b2 hold independent of what doAnythingAtAll does.

> In any imperative OO language I know of, this is easy to implement. The
> bounds object keeps a hidden reference to the DOMQuad and implements its
> readonly APIs as functions of the DOMQuad state, and the DOMQuad keeps an
> reference its bounds object.
>
> So, notably, this is not compatible with the APIs in the spec, where there
> is no such hidden reference to the DOMQuad. The bounds object is a simple
> DOMRectReadOnly, and is not constructed with any such internal linkages.
>

I was under the impression that WebIDL interfaces are, well, *interfaces*
--- that they don't need to describe all internal state.

Rob
-- 
Jtehsauts  tshaei dS,o n" Wohfy  Mdaon  yhoaus  eanuttehrotraiitny  eovni
le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o  Whhei csha iids  teoa
stiheer :p atroa lsyazye,d  'mYaonu,r  "sGients  uapr,e  tfaokreg iyvoeunr,
'm aotr  atnod  sgaoy ,h o'mGee.t"  uTph eann dt hwea lmka'n?  gBoutt  uIp
waanndt  wyeonut  thoo mken.o w

Received on Monday, 30 June 2014 02:23:19 UTC