String is open and dynamic!

P T Withington ptw at pobox.com
Thu Sep 27 16:38:09 PDT 2007


Oh right.  I hate primitive types.  Everywhere in my code I have to say:

   typeof x == 'string'  || x instanceof String

Will this get any better in es4?  I seem to recall that Dylan somehow  
kept Number open but sealed Integer and Float so you could have  
competitive numeric performance and still permit a user throwing in a  
Complex library.  Couldn't string be a sealed subclass of String so I  
can be generic if I use String, or I can restrict myself to string  
and be fast?

On 2007-09-27, at 09:58 EDT, Lars T Hansen wrote:

> You can subclass "String" but not "string", and the latter is not a
> subclass of the former, which is just a container class.  So I might
> not open the Champagne quite yet, if I were you.
>
> --lars
>
> On 9/27/07, P T Withington <ptw at pobox.com> wrote:
>> I was just about to ask if I would be able to subclass String in es4,
>> and I find I can!  Hurray!
>>
>> (Because the OpenLaszlo debugger creates 'annotated' strings with its
>> printf method that remember the objects associated with each string
>> representation.  I have to kludge this in es3 because these annotated
>> strings are not instances of String...)
>> _______________________________________________
>> Es4-discuss mailing list
>> Es4-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es4-discuss
>>




More information about the Es4-discuss mailing list