Re: comments on Matrix

Sent from my iPhone

On Mar 21, 2013, at 11:27 AM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:

> On Thu, Mar 21, 2013 at 11:21 AM, Rik Cabanier <cabanier@gmail.com> wrote:
>> Direct2D also refuses to do the inversion:
>> http://msdn.microsoft.com/en-us/library/windows/desktop/dd372277(v=vs.85).aspx
>> Given that all the libraries refuse to invert and all of Adobe's graphics
>> applications (such as Photoshop and Illustrator) do the same under the hood
>> with no ill effects, let's not do this by default.
>> 
>> If you feel very strongly, we can provide another call that never throws. We
>> would have to change the IDL of the matrix interface though since it could
>> now contain unrestricted doubles.
> 
> This is very much the wrong decision.  Throwing is a *very* disruptive
> thing in Javascript.  You don't just "catch it and abort", because
> there's rarely a reason to assume that any given calculation will
> fail.  Do you wrap try/catches around every single matrix inversion in
> your code?  Of course not.
> 
> Web APIs should *not* be throwing except in actual exceptional error
> situations.  When possible, they should fail gracefully.  Anything
> else is just asking for pages to die for no good reason.  The fact
> that this can throw or not depending on the precise algorithm/number
> implementation underneath makes it even worse.
> 
> If you'd like to track whether or not the inversion failed, so authors
> don't have to check the matrix themselves, add a flag.
> 
> I'll formally object to an exception being thrown here.

Why didn't you object to SVG 1.1 :). 

To be honest, SVGMatrix is the only reason why I added this exception to the Matrix Interface in the first place. Even so, what do you return when you do not throw? A matrix with a bunch of NaN as suggested by Benoit? Even if all attributes are restricted doubles?

Greetings
Dirk

> 
> ~TJ
> 

Received on Thursday, 21 March 2013 18:49:14 UTC