Comments to the JSON related proposals

zwetan zwetan at gmail.com
Tue Aug 21 01:24:06 PDT 2007


On 8/20/07, Kris Zyp <kriszyp at xucia.com> wrote:
> What if instead of only exposing property enumerability we exposed all the
> property attributes that were previously hidden in ES3 (and included
> "transient" as one of those properties)?
> obj={tempKey:1,myConst:2,hidden:3};
> obj.setAttributes("tempKey",Properties.TRANSIENT); // define transient
> without a class
> obj.setAttribute("myConst",Properties.READONLY); // we could define
> constants without classes
> and get rid of propertyIsEnumerable:
> obj.propertyIsEnumerable("hidden",false) ->
> obj.setAttributes("hidden",Properties.DONTENUM);
>
> The toJSONString for objects could then include a check (as well as any
> other serialization schemes that users might write):
> if (!(obj.getAttributes(key) & Properties.TRANSIENT))
>     ..serialization...
>
> I would love this, but I am guessing that most would think this a little bit
> too much power for users...

+1 for being able to set the attributes

but I think we should not add a TRANSIENT attributes for ES3,
DONTENUM should be enought and backward compatible

ActionScript 1 and 2 allow to do such thing
with the "undocumented" ASSetPropFlags
http://osflash.org/flashcoders/undocumented/assetpropflags

and no that not too much power to the user =)

zwetan



More information about the Es4-discuss mailing list