Re: Proposal for SVG type constructors

On Fri, 06 Feb 2009 09:05:36 +0100, Alexander Adam <alexander.adam@examotion.com> wrote:

>
> Hi there!
>
> Maybe dumb question but:
>
>>2. SVGLength
>>
>>  [Constructor,
>>   Constructor(in float value),
>>   Constructor(in short unitType, in float value),
>>   Constructor(in DOMString value)]
>>  interface SVGLength {
>>    /* ...existing SVGLength members here... */
>>  };
>
> Is it a requirement to explicitely specify all parameters? As if not, then we'd get ambiguous resolve issues for new SVGLength(5) which could be a float or a short.

As noted in the proposal it probably makes more sense to specify the value as the first parameter.

...
> Frankly, I am very uncertain whether constructors do really make sense. Why not extended existing stuff like you mentioned that the PathSeg Factories already have constructions parameters, why not using them on the other factories too instead of introducing just another level.. like extending this:
...
> p.matrixTransform(document.documentElement.createSVGMatrix(a,b,c,d,e,f))

Seing how the matrix has no ties to the document element I think it's unnecessary to have to go through it in order to create a basic type.

> Or maybe it'd be possible to make the documentElement global as well? That is, we could then call something like
>
> p.matrixTransform(createSVGMatrix(a,b,c,d,e,f));

That wouldn't fit well with the current architecture IMHO.

> Besides, there's another issue. We for example are not capable on handling constructors within Jscript / Com and Microsoft Technology which we require to use to interact with IE HTML so that'd be definitely a no-go as well. Besides, I've liked the original idea much more -- see, instead of writing constructors it'd be much more efficient to use the javascript engine's capabilities and supply anonymous property objects like
>
> p.matrixTransform({a: a, ...});

A problem mentioned in the most recent telcon is that the interfaces sometimes have methods. It's also quite possible that with the new constructors such anonymous objects could be automatically typeconverted, e.g to a string, so that it would work anyway. 

Adding a constructor that takes an Object and then calls some defined functions on it might be another solution. Then perhaps we'd need just that one constructor.

Cheers
/Erik

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

Received on Friday, 6 February 2009 09:50:52 UTC