Re: Primitives vs. Objects, Ruby-like features

2008-03-28 Thread Jason Orendorff
On Mon, Mar 24, 2008 at 9:43 PM, Darryl [EMAIL PROTECTED] wrote: typeof(1) == number typeof(new Number(1)) == object [...] Will these be made uniform in JS2? No, it would be a pretty big breaking change from ES3. ES4 is considering several small breaking changes, but nothing this major. I

Re: Primitives vs. Objects, Ruby-like features

2008-03-26 Thread Nathan de Vries
On Mon, 2008-03-24 at 19:43 -0700, Darryl wrote: It'd also be nice to have non-mandatory function call parens like in Ruby No it wouldn't. Functions get passed around a hell of a lot more in Javascript than they do in Ruby, which means that you'd need to rely on something akin to Ruby's

Primitives vs. Objects, Ruby-like features

2008-03-24 Thread Darryl
In current versions of JS there's some weird stuff where some primitives are equal to their object equivalents: 1 == new Number(1) But in other cases they're not equivalents at all: typeof(1) == number typeof(new Number(1)) == object And sometimes theres weird syntax errors: 5.prototype

Re: Primitives vs. Objects, Ruby-like features

2008-03-24 Thread Darryl
But the all important problem with your argument, Brendan, is that Ruby manages to allow 5.0 to be a float, and 5.times to be a method call, without any ambiguity. If Ruby can do it, why can't JavaScript? --- o/// Be seeing you...

Re: Primitives vs. Objects, Ruby-like features

2008-03-24 Thread Darryl
I'll grant you one thing tho: Ruby requires 99.0 where JS allows 99.. To be honest, saving that one character when making whole-number valued floats (which are indistinguishable form NON floats, i.e. 99 == 99. == 99.0), at the expense of being able to do 99.abs or something like that, is

Re: Primitives vs. Objects, Ruby-like features

2008-03-24 Thread Darryl
I'd also point out that 5..prototype doesn't work, even tho 5. is a float, and therefore this should be valid syntax. That hanging dot pointless, AND inconsistent. This could just be implementation wise, ofcourse. --- o/// Be seeing you...

Re: Primitives vs. Objects, Ruby-like features

2008-03-24 Thread Brendan Eich
On Mar 24, 2008, at 8:16 PM, Darryl wrote: But the all important problem with your argument, Brendan, is that Ruby manages to allow 5.0 to be a float, and 5.times to be a method call, without any ambiguity. If Ruby can do it, why can't JavaScript? Please don't ask dumb rhetorical questions.