Controlling DontEnum (was: ES4 draft: Object)

Lars Hansen lhansen at
Thu Mar 13 13:43:40 PDT 2008

> -----Original Message-----
> From: es4-discuss-bounces at 
> [mailto:es4-discuss-bounces at] On Behalf Of liorean
> Sent: 13. mars 2008 14:31
> To: es4-discuss at
> Subject: Re: Controlling DontEnum (was: ES4 draft: Object)
> >  I still think it may be right that properties in non-public  
> > namespaces should not be enumerated, but I also think that's  
> > orthogonal to the discussion that's going on here, about  dynamic 
> > properties and their attributes.  We've pretty much decided (ticket 
> > #233 has some of the discussion) that for  future compatibility
> > ought to be a difference between  fixture properties and DontDelete 
> > "dynamic" properties.  So  dynamic properties have at least one 
> > attribute bit like they  do in ES3 (for deletability).
> > they might as  well have all the ES3 bits: for enumerability and 
> > writability.
> For ES4, shouldn't this function also take a type binding?

Let people who really want to use type-constrained properties 
migrate to a class, or find some way to use an object literal
with a structural type.

At present the language does not allow dynamic, typed properties,
unless I'm mistaken.  (The 'const' and 'var' keywords in object
literals introduce fixtures.)  I'm not saying they can't be useful,
but we're now far afield from controlling 'dontEnum'.

> >  (They're not independent, ReadOnly implies DontDelete.)
> >
> >  __createProperty__ should throw an exception (TypeError?) if  the 
> > property already exists on the object or would shadow a  ReadOnly 
> > property, a la [[CanPut]], or if the object is not  dynamic.  It 
> > should probably throw an exception if its  arguments are not 
> > consistent (ReadOnly && !DontDelete).
> If ReadOnly is specified, is there even a reason to look at 
> DontDelete?

I think it's polite to notify the programmer that he's done 
something silly and I find special case "smart" rules to be
annoying unless they solve real problems (and I don't see this
as one of those).  In this case it's not a deeply held conviction
on my part, just the way I see it.

> >   function __createProperty__(name:EnumerableId,
> >                               dontEnum:boolean=false,
> >                               dontDelete:boolean=false,
> >                               readOnly:boolean=false): void
> ReadOnly would need to be instanciated at the same time, no? 

I assume you're referring to my having left the value argument out
by mistake (second argument).

Or was there something else?


More information about the Es4-discuss mailing list