W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2012

Unrestricted dictionary

From: Brian Birtles <bbirtles@mozilla.com>
Date: Wed, 15 Aug 2012 09:43:00 +0900
Message-ID: <502AF094.3030501@mozilla.com>
To: public-script-coord@w3.org
Dear all,

I'd like to propose a kind of dictionary where the keys are unrestricted.

The use case is the Web Animations specification[1] where we are 
considering providing an interface similar that that of the Raphaƫl 
library[2]. Namely, like so:

   var anim = new Anim(elem, { dur: 2, height: '100px' });

In this example, 'height' corresponds to a CSS property on elem which we 
want to animate but could potentially be any animatable CSS property.

This is obviously a lot easier than splitting this out into a separate 
property like so:

   var anim = new Anim(elem, { dur: 2, prop: 'height', to: '100px' });

particularly when animating multiple CSS properties simultaneously.

I spoke with Cameron about this and it seems having a kind of 
unrestricted dictionary-like thing would be useful for cases like this.

I'm afraid I'm still unfamiliar with the terminology of WebIDL but I 
think roughly what is required is the ability to have a collection of 
properties where the set of properties/keys is unrestricted and the type 
of the values is also free. Obviously prose would be required to 
describe how to interpret whatever members were found.

Does that make any sense?

Best regards,

Brian

[1] https://dvcs.w3.org/hg/FXTF/raw-file/tip/web-anim/index.html (see 
section 5.1, 'the Anim interface', for where the use case in this email 
appears)
[2] http://raphaeljs.com/
Received on Wednesday, 15 August 2012 00:43:31 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:06 UTC