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

Re: How to specify an object that can be mutable or immutable

From: Dirk Schulze <dschulze@adobe.com>
Date: Thu, 26 Sep 2013 05:09:41 -0700
To: "robert@ocallahan.org" <robert@ocallahan.org>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <C1BFBC56-97FE-4D6F-91A9-CD33CB8E95B7@adobe.com>

On Sep 26, 2013, at 1:13 PM, Robert O'Callahan <robert@ocallahan.org> wrote:

> Immutability and read-only are different. An immutable object is one that is guaranteed to not change. In your case, a DOMRectReadOnly can change --- if it's actually a DOMRect. You just can't change it through the DOMRectReadOnly interface.

I got that. I just wonder if everyone does.

Since you probably don't modify the object passed as argument, you don't just want to allow DOMRect. So you use DOMRectImmutable (or DOMRectReadOnly), and this potentially could confuse people reading the WebIDL definition. However, this is a minor issue. I have nothing against the proposed inheriting structure for all the proposed geometries.

Greetings,
Dirk

> 
> This would be more clear if we called it DOMRectImmutable; it would be odd to have DOMRect extend DOMRectImmutable, because a DOMRect isn't immutable.
> 
> 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 Thursday, 26 September 2013 12:10:15 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:50 UTC