Strawman: Decouple [ ] and property access

Erik Arvidsson erik.arvidsson at gmail.com
Fri Nov 11 10:02:57 PST 2011


I implemented this for Traceur last week. The abstraction is leaky
since Traceur does not have private names yet but it is still good
enough for a demo.

http://traceur-compiler.googlecode.com/svn/trunk/example/collection.html

Instead of private names we just use Object.define*

On Fri, Nov 11, 2011 at 08:56, Axel Rauschmayer <axel at rauschma.de> wrote:
> That the [] decoupling is needed can by seen by the fact that dicts can’t
> have a size() method (as opposed to the dictionary solution in the
> strawman).
> On Nov 11, 2011, at 17:45 , Allen Wirfs-Brock wrote:
>
> thanks, a good suggestion.
>
> Actually they are quite different.  The dict proposal is simply defining one
> new data types that can be used as a key value store which is guaranteed not
> to have any pre-existing key conflicts prior to initial use.
>
> My proposal, defines a general extensible mechanism that  JS programmers can
> use to define many kinds of new collection abstractions all of which use a
> consistent accessing syntax whose semantics is completely under the control
> of the programmer.
>
> A comparison to 'dict' which shares the expressed goals of the above
>
> proposal would be a great addition. Roughly speaking it appears to be
>
> "more ambitious than", meaning more effort and more power.
>
> --
> Dr. Axel Rauschmayer
> axel at rauschma.de
> home: rauschma.de
> twitter: twitter.com/rauschma
> blog: 2ality.com
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>



-- 
erik


More information about the es-discuss mailing list