W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2014

Re: Exposing constructors of readonly interfaces to web authors

From: Robert O'Callahan <robert@ocallahan.org>
Date: Mon, 30 Jun 2014 14:22:52 +1200
Message-ID: <CAOp6jLbKBH7SLD-iwTBFWNmXtYOxZSw=2c6Fpo+-o+hiOGRR1w@mail.gmail.com>
To: Domenic Denicola <domenic@domenicdenicola.com>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
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

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