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

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