Re: Controlling DontEnum (was: ES4 draft: Object)

2008-04-20 Thread P T Withington
[Coming late to the party] On 2008-03-13, at 12:47 EDT, Lars Hansen wrote: > function __createProperty__(name:EnumerableId, > dontEnum:boolean=false, > dontDelete:boolean=false, > readOnly:boolean=false): void

RE: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Lars Hansen
at of __createProperty__.) --lars > -Original Message- > From: Mark S. Miller [mailto:[EMAIL PROTECTED] > Sent: 13. mars 2008 17:22 > To: Lars Hansen > Cc: es4-discuss@mozilla.org > Subject: Re: Controlling DontEnum (was: ES4 draft: Object) > > >> From

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Mark S. Miller
>> From: Neil Mix [mailto:[EMAIL PROTECTED] >> >> function __createProperty__(name:EnumerableId, >> value:*, >> enumerable:boolean=true, >> removable:boolean=true, >> writable:boolean

RE: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Lars Hansen
t; Cc: Neil Mix; es4-discuss@mozilla.org > Subject: Re: Controlling DontEnum (was: ES4 draft: Object) > > On Mar 13, 2008, at 2:07 PM, Lars Hansen wrote: > > >> -Original Message- > >> From: Neil Mix [mailto:[EMAIL PROTECTED] >

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Brendan Eich
On Mar 13, 2008, at 2:07 PM, Lars Hansen wrote: >> -Original Message- >> From: Neil Mix [mailto:[EMAIL PROTECTED] >> >> function __createProperty__(name:EnumerableId, >> value:*, >> enumerable:boolean=true, >>

RE: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Lars Hansen
> -Original Message- > From: Neil Mix [mailto:[EMAIL PROTECTED] > Sent: 13. mars 2008 14:47 > To: Lars Hansen > Cc: es4-discuss@mozilla.org > Subject: Re: Controlling DontEnum (was: ES4 draft: Object) > > On Mar 13, 2008, at 11:47 AM, Lars Hansen

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread liorean
> > [mailto:[EMAIL PROTECTED] On Behalf Of liorean > > ReadOnly would need to be instanciated at the same time, no? On 13/03/2008, Lars Hansen <[EMAIL PROTECTED]> wrote: > I assume you're referring to my having left the value argument out > by mistake (second argument). > > Or was there someth

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Neil Mix
On Mar 13, 2008, at 11:47 AM, Lars Hansen wrote: > function __createProperty__(name:EnumerableId, > dontEnum:boolean=false, > dontDelete:boolean=false, > readOnly:boolean=false): void I like where this is goi

RE: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Lars Hansen
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of liorean > Sent: 13. mars 2008 14:31 > To: es4-discuss@mozilla.org > Subject: Re: Controlling DontEnum (was: ES4 draft: Object) > > > I still think it may be right th

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread liorean
On 13/03/2008, Lars Hansen <[EMAIL PROTECTED]> wrote: > Since our method is creating a new property and not setting > one, I suggest __createProperty__ as the most appropriate > name, so I'm going to use that below. Sounds perfectly reasonable to me. > I still think it may be right that prope

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Kris Zyp
> set dontDelete and readOnly? You can create non-deletable properties > by using a class or record type They can't be added after an object is created. > and you can create read-only > properties by adding a get function without a corresponding set... Unless behavior is different than ES3, setter

RE: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Lars Hansen
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Peter Hall > Sent: 13. mars 2008 12:38 > To: Lars Hansen > Cc: Kris Zyp; es4-discuss@mozilla.org > Subject: Re: Controlling DontEnum (was: ES4 draft: Object) > > Is there e

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Peter Hall
Is there enough value in complicating matters by adding the ability to set dontDelete and readOnly? You can create non-deletable properties by using a class or record type, and you can create read-only properties by adding a get function without a corresponding set... Are there any use cases where

RE: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Lars Hansen
> -Original Message- > From: Kris Zyp [mailto:[EMAIL PROTECTED] > Sent: 13. mars 2008 11:27 > To: Lars Hansen; es4-discuss@mozilla.org > Subject: Re: Controlling DontEnum (was: ES4 draft: Object) > > > the frequency of use). Thus on Object.prototype and as an

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Kris Zyp
> the frequency of use). Thus on Object.prototype and as an > intrinsic propety on Object instances: > > function __createProperty__(name:EnumerableId, > dontEnum:boolean=false, > dontDelete:boolean=false, > re

RE: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Lars Hansen
-Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Kris Zyp > Sent: 11. mars 2008 23:13 > To: Brendan Eich > Cc: Neil Mix; Peter Hall; es4-discuss@mozilla.org > Subject: Re: Controlling DontEnum (was: ES4 draft: Object) > > > >

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Kris Zyp
>> Object.prototype.__setPropertyWithAttributes__(name, value, dontEnum: >> boolean, readOnly: boolean, dontDelete: boolean); > > Only if you cannot change an existing properties attribute, or delete an > existing property and create a new one with the same name. Those cases > would have to fa

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Brendan Eich
On Mar 11, 2008, at 8:32 PM, Kris Zyp wrote: > I like it too. Any chance that by setting the attribute at the same > time of > setting the property value, we could resurrect the possibility of > setting > other attributes as well (with a single method): > > Object.prototype.__setPropertyWithAt

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Garrett Smith
On Tue, Mar 11, 2008 at 8:32 PM, Kris Zyp <[EMAIL PROTECTED]> wrote: > >> I've read mention of the weirdness of the timing window between the > >> property definition and it's marking as non-enumerable. That combined > >> with the above observation makes me wonder if this should really be > >>

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Kris Zyp
>> I've read mention of the weirdness of the timing window between the >> property definition and it's marking as non-enumerable. That combined >> with the above observation makes me wonder if this should really be >> obj.__setNonEnumerableProperty__(name, value); > > +1 I like it too. Any chance

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Brendan Eich
On Mar 11, 2008, at 3:21 PM, Neil Mix wrote: > On Mar 11, 2008, at 5:16 PM, Kris Zyp wrote: > >> Declarative is nice, but as mentioned before, it ignores one of the >> primary >> use cases: addition of non-enumerable properties to built-ins (by >> libraries, >> primarily). > > I've read mention of

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Brendan Eich
On Mar 11, 2008, at 2:45 PM, Brendan Eich wrote: > Proposal: Add Object.prototype.__makePropertyNonEnumerable__(name), > defined as if by: > > Object.prototype.__makePropertyNonEnumerable__ = function > (name) { > if (this has a direct property identified by name) { >

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Neil Mix
On Mar 11, 2008, at 5:16 PM, Kris Zyp wrote: > Declarative is nice, but as mentioned before, it ignores one of the > primary > use cases: addition of non-enumerable properties to built-ins (by > libraries, > primarily). I've read mention of the weirdness of the timing window between the pr

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Kris Zyp
> It seems wrong that the code should run once one way, and then another > way, but there be no way back. It's not so much that I think there > should be a way back, but I'd rather that than this, which I consider > a weird situation. Declarative is nice, but as mentioned before, it ignores one of

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Mark Miller
On Tue, Mar 11, 2008 at 2:32 PM, Peter Hall <[EMAIL PROTECTED]> wrote: > Perhaps you can't achieve this without new syntax, but the declarative > approach seems cleanest and not prone to this sort of anomaly. If new > syntax could be considered, an |enumerable| attribute, complemented by > a |!

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Mark Miller
[+google-caja-discuss] On Tue, Mar 11, 2008 at 12:53 PM, Kris Zyp <[EMAIL PROTECTED]> wrote: > > The use of a __-bracketed name satisfies the second goal, but it > > would be a problem for Caja or similar. This is an issue where I > > would appreciate Mark's feedback. > > I can't speak for Mark

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Peter Hall
If there is no method to make a property enumerable again (which I now agree is better not to exist) it feels somehow bad to be able to make a property non-enumerable after its declaration. Consider: let a = {b:2, c:3}; for(let s in a){ print(s); // b, c } a.__makePropertyNonEnumerable__("b"); f

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Kris Zyp
> The use of a __-bracketed name satisfies the second goal, but it > would be a problem for Caja or similar. This is an issue where I > would appreciate Mark's feedback. I can't speak for Mark, but it seems like it might actually be beneficial that unsecured code (regular ES4) would have the abil

Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Brendan Eich
Here is a modest proposal based on Mark's and Maciej's messages: Goal: A detectable method requiring no new syntax to set the DontEnum attribute on an existing property. Goal: Avoid breaking any existing ES3 code that might depend on a plainly named method not being predefined. Anti-goal: Th