On Wed, Jun 4, 2014 at 10:23 AM, Robert O'Callahan <rob...@ocallahan.org> wrote:
> On Wed, Jun 4, 2014 at 1:13 AM, Benoit Jacob <jacob.benoi...@gmail.com> > wrote: > >> This list misses some of the points that I care more about: >> - Should DOMMatrix really try to be both 3D projective transformations >> and 2D affine transformations or should that be split into separate classes? >> > > I raised this issue too a while ago, but now I think a single interface is > better. It makes it easier to write code that will "just work" for both 2D > and 3D cases. Since 3D is pretty common, it simplifies things for authors > to only have one interface instead of two. Sure, we could have two > interfaces that are consistent, but then we'd need a way to upgrade a 2D > matrix to 3D and/or have some methods on the 3D matrix overloaded to take > 2D matrix parameters. With a reliable is2D method, and internal > optimizations to special-case 2D vs 3D, I think we'll be in a good place. > The only real advantage of a separate 2D interface is that WebIDL could > express the constraint that a matrix is 2D, but I suspect that's not very > important. > Actually, it might be possible to have separate DOM2DMatrix and DOMMatrix interfaces that offer identical API and use WebIDL tricks to return the right type of matrix. For example to have DOM2DMatrix.translate overloaded so the 2-param version returns a DOM2DMatrix and the 3-param version returns a DOM3DMatrix. With enough effort we might be able to get rid of is2D and have the 2D state fully encoded in the WebIDL type. However, it would get complicated, especially because we'd need DOM2DMatrixReadOnly and DOMMatrixReadOnly types too. I think I prefer the simpler approach with fewer interfaces. 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