Semantics of "indexed" string access

Brendan Eich brendan at mozilla.org
Wed Jun 25 12:19:51 PDT 2008


On Jun 24, 2008, at 9:34 PM, Allen Wirfs-Brock wrote:
> Note that steps 1,2, and 5 amount to ToObject(GetValue(“abc”)).   
> GetValue(“abc”) yields “abc” so this is really just ToObject 
> (“abc”).  9.9 says ToObject when applied to a s primitive string:  
> “Create a new String object whose [[value]] property is set to the  
> value of the string.”.  That string object becomes the base object  
> of the resulting Reference.  So the literal get converted into an  
> object that  has a [[Get]]
>

Oh, I agree -- that's why I wrote "No" in reply to your "Am I  
wrong?" :-).

/be

> From: Brendan Eich [mailto:brendan at mozilla.org]
> Sent: Tuesday, June 24, 2008 7:34 PM
> To: Allen Wirfs-Brock; Maciej Stachowiak
> Cc: es3.x-discuss at mozilla.org x-discuss; Pratap Lakshman (VJ#SDK);  
> es4-discuss at mozilla.org es4-discuss
> Subject: Re: Semantics of "indexed" string access
>
>
>
> On Jun 24, 2008, at 6:39 PM, Allen Wirfs-Brock wrote:
>
>
>
>
> Actually, the intent was to support “indexed” access to both string  
> values and string wrapper objects.  I just didn’t make it clear in  
> the example.  The case analysis was intended to apply to both. My  
> reading of section 11.2.1 is that  a string value is to be  
> transformed into an object before any actual property access  
> semantics are applied. Am I wrong?
>
>
>
> No, the primitive string type (called "String", confusingly, in  
> ES1-3 when it uses type names) is not an object. It has no internal  
> methods such as [[Get]].
>
>
>
> Specifying the indexed unit-string access semantic based on the  
> wrapper String (spelled as in the language) object seems ok. I  
> noted a Result(4) that should have been Result(6) in step 7, via  
> private email to Allen (this type of error is going to happen a  
> lot; count on it).
>
>
>
> /be
>
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20080625/3c7839a8/attachment-0002.html 


More information about the Es4-discuss mailing list