Objects for Number, String, Boolean, Date acts like their native counter part

David-Sarah Hopwood david-sarah at jacaranda.org
Sun May 17 17:14:08 PDT 2009


Biju wrote:
> [behaviour of wrappers] is weird...
> 
> Why cant we make objects for Number, String, Boolean, Date acts like
> their native counter part?
> That will be what an average web developer expecting.
> And I dont think it will make existing web break.

No, this brokenness is heavily relied on. It's not an obscure corner case.

Just don't use wrapper objects [*]. They are totally unnecessary and
useless. If a fix is needed, it is to have the spec say that explicitly.


[*] except where they are generated implicitly as temporaries when a
    property of a primitive value is accessed -- although I bet most
    JS programmers don't even know that is happening.

-- 
David-Sarah Hopwood ⚥



More information about the es-discuss mailing list