Re: [matrix][cssom-view] DOMPoint, DOMPointLiteral definitions

On 9/25/13 1:27 AM, Dirk Schulze wrote:
> I don't think so. We have this behavior in SVG for years.

I was describing it from the point of view of a JS author.

Immutable things in JS work in a certain way (either an accessor with no 
setter, or a value prop marked readonly).  We should aim to have the 
APIs we design work that same way.

Obviously the SVG DOM API looks nothing like what JS APIs tend to look 
like.  But that's not a reason to be following the historical SVG 
pattern here, quite the contrary.

>  You can also describe what happens if it is not mutable and the author tries to modify the object.

My point is that the thing that _should_ happen in this case to be 
consistent with how normal JS objects work is not describable in prose, 
because it needs to happen before you ever get to the prose.

> That is what I did for DOMMatrix [1].

Right, that throws on sets in non-strict mode.  Which is not how normal 
JS objects behave on sets of immutable properties.

> So the both WGs should work together for a unified API.

I strongly suggest doing API design like this in public-script-coord, 
with input from people familiar with JS APIs, not in working groups that 
have no particular expertise designing such APIs....

-Boris

Received on Wednesday, 25 September 2013 05:35:14 UTC