Re: comments on Matrix

On Thu, Mar 21, 2013 at 12:52 PM, Brandon Jones <bajones@google.com> wrote:

> I'd like to throw another voice in against throwing exceptions. The faulty
> assumption here being that if a matrix fails to invert this is worth
> stopping the entire app for.
>
> Realistically most authors will blindly invert and never give a second
> glance to the result. If invert throws this will result in many apps simply
> halting, with the only way to get it back being a refresh. If invert
> returns NaNs or similar most apps will have a bit of graphical data
> flicker, become lit incorrectly, or possibly disappear. Depending on the
> structure of the app this may naturally resolve itself within a frame or
> two. While you can argue that a throw will make invert issues easier to
> debug I feel that most authors would rather have a suboptimal user
> experience than no user experience.
>
> If you absolutely MUST retain compatibility with this aspect of SVGMatrix
> then so be it, but I would highly favor including a non-throwing variant
> and promoting that one as the preferred call.
>

I think that's fine. We'll add another invert call that returns a boolean
and takes a matrix.

Rik


> On Thu, Mar 21, 2013 at 11:59 AM, Dirk Schulze <dschulze@adobe.com> wrote:
>
>>
>> On Mar 21, 2013, at 11:52 AM, "Tab Atkins Jr." <jackalmage@gmail.com>
>> wrote:
>>
>> > On Thu, Mar 21, 2013 at 11:47 AM, Rik Cabanier <cabanier@gmail.com>
>> wrote:
>> >> On Thu, Mar 21, 2013 at 11:36 AM, James Robinson <jamesr@google.com>
>> wrote:
>> >>> On Thu, Mar 21, 2013 at 11:33 AM, Rik Cabanier <cabanier@gmail.com>
>> wrote:
>> >>>> I'll formally object to an exception being thrown here.
>> >>>>
>> >>>> SVG matrix throws an exception and since this is a drop-in
>> replacement,
>> >>>> Matrix needs to throw one too :-(
>> >>>
>> >>> This is a clear example of SVG making a (bad) mistake that we should
>> not
>> >>> inflict on the rest of the web platform.
>> >>
>> >> Are you objecting to any exceptions being thrown?
>> >> There are exceptions in all authors facing APIs.
>> >
>> > No, he objects for the same reason I am - a matrix being singular is
>> > not a particularly exceptional situation
>>
>> A singular matrix does not mean the same as NaN and Inf values in the
>> matrix.
>>
>> However, you need to take a look when you use inverse() for
>> transformation matrices (again, that is the focus here). They are used to
>> transform between coordinate spaces. And then a returning singular matrix
>> does not make sense.
>>
>> Dirk
>>
>> > , and whether an
>> > implementation considers a matrix singular will depend in some cases
>> > on the exact algorithm and FP implementation being used.  This is,
>> > thus, a *terrible* example of a place to throw an exception, as
>> > authors won't expect it, and it'll vary between platforms for no
>> > important reason.
>> >
>> > ~TJ
>> >
>>
>>
>

Received on Thursday, 21 March 2013 21:25:24 UTC