ES4 draft: Name

Lars Hansen lhansen at adobe.com
Mon Mar 17 17:29:16 PDT 2008


That won't work; n1 and n2 are final and non-dynamic.  And the prototype
property is on the prototype, so you'd have to go

Name.prototype.toString = function () ...

but then you know what you're doing, hopefully.

--lars 

> -----Original Message-----
> From: peterjoel at gmail.com [mailto:peterjoel at gmail.com] On 
> Behalf Of Peter Hall
> Sent: 17. mars 2008 18:25
> To: Lars Hansen
> Cc: Erik Arvidsson; es4-discuss at mozilla.org
> Subject: Re: ES4 draft: Name
> 
> Perhaps, something like this:
> 
> var n1 = new Name("foo", "bar");
> var n2 = new Name("foo", "bar");
> 
> n1.toString = function(){.....}
> 
> An implementation might have reasonably shared the same instance for
> n1 and n2, but a user might be surprised that the new 
> toString() function is now found on what he considered to be 
> two separate instances.
> 
> Peter
> 
> 
> On Tue, Mar 18, 2008 at 12:18 AM, Lars Hansen 
> <lhansen at adobe.com> wrote:
> > Prototype properties are generally just DontEnum.  Why would  the 
> > toString prototype function need to be const for Name and  
> Namespace?
> >
> >
> >
> >  --lars
> >
> >  > -----Original Message-----
> >  > From: Erik Arvidsson [mailto:erik.arvidsson at gmail.com]  
> > Sent: 17. 
> > mars 2008 18:09  > To: Lars Hansen  > Cc: 
> es4-discuss at mozilla.org  > 
> > Subject: Re: ES4 draft: Name  >  > Fair enough.  On a related 
> > question, does the following allow  > removal of the field?
> >  >
> >  > prototype function toString(this:Namespace)
> >  >     this.intrinsic::toString()
> >  >
> >  > If not these should be changed to
> >  >
> >  > prototype const function toString(this:Namespace)
> >  >     this.intrinsic::toString()
> >  >
> >  > for Name and Namespace.
> >  >
> >  > On Mon, Mar 17, 2008 at 17:06, Lars Hansen 
> <lhansen at adobe.com> wrote:
> >  > > I don't know if that's necessary; it follows directly 
> from the  > 
> > > properties you mention and the fact that == and === work by  >  
> > comparing  > > the component fields.  (By analogy,  > >  ES3 
> > implementations already perform a fair amount of string  > 
> > interning 
> > but I don't recall that being discussed in the ES3  > >  
> spec.)  > >  
> > > >  --lars  > >  > >  > >  > >  > -----Original 
> Message-----  > >  > 
> > From: Erik Arvidsson [mailto:erik.arvidsson at gmail.com]  > > 
> Sent: 17.
> >  > > mars 2008 17:28  > To: Lars Hansen  > Cc:
> >  > es4-discuss at mozilla.org  >
> >  > > Subject: Re: ES4 draft: Name  >  > Should there be some 
> > informative  > > text explaining that Names  > are immutable (non 
> > dynamic, final and  > > only constant fields)  > so interning Name 
> > objects is  > something that  > > might be useful  > for 
> > implementations?
> >  > >  >
> >  > >  > 2008/3/17 Lars Hansen <lhansen at adobe.com>:
> >  > >  > > Draft 3 of the spec for the Name class.  
> Changelog near the  
> > >  > > beginning.
> >  > >  > >
> >  > >  > >  The main change is that Name extends Object (not String) 
> > and  > > that  > > ===,  ==, !==, and != operate not on object  > 
> > identity or on  > > string  > > representation but directly 
> on the  > 
> > (qualifier,identifier)  > > > pair.  (A  > > draft of an 
> enumerability 
> > spec that  > justifies these  > > changes is  > >  
> forthcoming.)  > >  
> > > >  --lars  > >  > >  > > 
> > _______________________________________________
> >  > >  > >  Es4-discuss mailing list
> >  > >  > >  Es4-discuss at mozilla.org
> >  > >  > >  https://mail.mozilla.org/listinfo/es4-discuss
> >  > >  > >
> >  > >  > >
> >  > >  >
> >  > >  >
> >  > >  >
> >  > >  > --
> >  > >  > erik
> >  > >  >
> >  > >
> >  >
> >  >
> >  >
> >  > --
> >  > erik
> >  >
> >  _______________________________________________
> >  Es4-discuss mailing list
> >  Es4-discuss at mozilla.org
> >  https://mail.mozilla.org/listinfo/es4-discuss
> >
> 



More information about the Es4-discuss mailing list