Re: comments on Matrix

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

> On Thu, Mar 21, 2013 at 11:33 AM, Rik Cabanier <cabanier@gmail.com> wrote:
> > SVG matrix throws an exception and since this is a drop-in replacement,
> > Matrix needs to throw one too :-(
>
> Are we sure about that?  I'd prefer to look at some SVGMatrix-using
> code to see if it actually relies on singular matrixes throwing, or if
> it just assumes they never will (my assumption) or simply ignores
> failure.  If either of the latter, we should feel free to change
> behavior.
>
> > Most libraries seem to return a boolean to say that a inversion failed
> which
> > seems better. I *believe* adding an exception to JS also forces the
> creation
> > of an exception object every time which is expensive.
>
> Only if you actually throw it.  It's not eagerly created every call.
>

I worked a little with the mozilla code base and it seems that they always
create the object.
It's probably not a huge amount of overhead since it's not dynamically
allocated.


>
> > Why don't we add another Inverse:
> >
> > boolean Inverse(Matrix);
> >
> > We could also move to unrestricted doubles so we can populate the matrix
> > with NaN or Inf if needed.
>
> Yes, that seems fine.
>
> ~TJ
>

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