2014-06-03 18:29 GMT-04:00 Robert O'Callahan <rob...@ocallahan.org>: > On Wed, Jun 4, 2014 at 10:26 AM, Rik Cabanier <caban...@gmail.com> wrote: > >> That would require try/catch around all the "invert()" calls. This is ugly >> but more importantly, it will significantly slow down javascript >> execution. >> I'd prefer that we don't throw at all but we have to because SVGMatrix >> did. >> > > Are you sure that returning a special value (e.g. all NaNs) would not fix > more code than it would break? > > I think returning all NaNs instead of throwing would be much better > behavior. >
FWIW, I totally agree! That is exaclty what NaN is there for, and floating point would be a nightmare if division-by-zero threw. To summarize, my order of preference is: 1. (my first choice) have no inverse() / invert() / isInvertible() methods at all. 2. (second choice) have inverse() returning NaN on non-invertible matrices and possibly somehow returning a second boolean return value (e.g. an out-parameter or a structured return value) to indicate whether the matrix was invertible. Do not have a separate isInvertible(). 3. (worst case #1) keep inverse() throwing. Do not have a separate isInvertible(). 4. (worst case #2) offer isInvertible() method separate from inverse(). Benoit > > 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 > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform