ARGUMENTS.SHOULD.BE.ARRAY bug-fix

zwetan zwetan at gmail.com
Mon Mar 19 13:01:43 PDT 2007


On 3/18/07, Brendan Eich <brendan at mozilla.org> wrote:
> The bug fix is clearly talking only about making arguments objects
> delegate to Array.prototype. It's not talking about new syntax to
> allow holes in actual parameter lists.
>

nothing much to add
but glad that this delegating is possible because of the genericity of
those methods :)

cf
"The splice function is intentionally generic; it does not require
that its this value be an Array
object. Therefore it can be transferred to other kinds of objects for
use as a method. Whether the
splice function can be applied successfully to a host object is
implementation-dependent."
etc...

but still out of curiosity,
in a case where someone would want to do the same kind of methods delegation
but with non-generic methods (this value required to be of the original type)
does ES4 offers some way of doing it ?

I'm thinking of reusing Date methods for examples in a "new" classes
like DateTime, TimeSpan, etc...
but Date methods require that the this value be the Date Object.

or another ex, like trying to inherit from the class String on the prototype
cf

class String2
    {
    prototype = new String();

    //etc...
    }

I know that String is final, but if someone want a Char class that is
not provided by default,
but which reuse almost all of the String Object methods, just applying
it to 1 char,
String being final is kind of painfull, a way to circumvent that would
be welcome :).


oups sorry for the HT subject in this thread, or maybe this can be use cases ?

cheers,
zwetan

ps: testing with Tamarin and Flex2 SDK



More information about the Es4-discuss mailing list