[Proto-Scripty] Re: Prototype bug?

2009-02-11 Thread Jim Higson
On Wednesday 11 February 2009 05:06:55 RobG wrote: The language is designed so you shouldn't need to care.  I think this helps the argument of why functions like isString are not a good idea.  If you want to test for specific properties or features of an object, test for them.  Don't test

[Proto-Scripty] Re: Prototype bug?

2009-02-10 Thread Jim Higson
On Feb 8, 1:19 pm, RobG rg...@iinet.net.au wrote: On Feb 8, 12:55 am, Jim Higson j...@333.org wrote: alert( Object.isString( foo )); // alerts string It alerts true. So it does ^-) alert( Object.isString( new String( foo ) )); // alerts object It alerts false. ^-) again I know

[Proto-Scripty] Re: Prototype bug?

2009-02-10 Thread Richard Quadling
2009/2/10 Jim Higson j...@333.org: On Feb 8, 1:19 pm, RobG rg...@iinet.net.au wrote: On Feb 8, 12:55 am, Jim Higson j...@333.org wrote: alert( Object.isString( foo )); // alerts string It alerts true. So it does ^-) alert( Object.isString( new String( foo ) )); // alerts object

[Proto-Scripty] Re: Prototype bug?

2009-02-10 Thread Jim Higson
Ha. I'm relatively new to JS and I though that ... var s_String = bob; was just a shortcut for var s_LooksLikeAStringButDoesNotGoQuack = new String(bob); I always thought that internally they were the same thing. I think a lot of people who used Javascript for a long time think the

[Proto-Scripty] Re: Prototype bug?

2009-02-10 Thread Richard Quadling
2009/2/10 Jim Higson j...@333.org: Ha. I'm relatively new to JS and I though that ... var s_String = bob; was just a shortcut for var s_LooksLikeAStringButDoesNotGoQuack = new String(bob); I always thought that internally they were the same thing. I think a lot of people who used

[Proto-Scripty] Re: Prototype bug?

2009-02-10 Thread Jim Higson
What does new String(bob) offer over normal bob? As far as I know, nothing. Hence my assertion that Prototype should treat object strings as if they were a normal string. Hmmm... actually I should have said nothing I've ever found useful :-) With

[Proto-Scripty] Re: Prototype bug?

2009-02-10 Thread Richard Quadling
2009/2/10 Jim Higson j...@333.org: What does new String(bob) offer over normal bob? As far as I know, nothing. Hence my assertion that Prototype should treat object strings as if they were a normal string. Hmmm... actually I should have said nothing I've ever found useful :-) With

[Proto-Scripty] Re: Prototype bug?

2009-02-10 Thread kangax
On Feb 10, 10:05 am, Richard Quadling rquadl...@googlemail.com wrote: [...] So, it seems the only place where things go wonky is with eval(). `eval ` treats passed string as a Program, and evaluates it as such. There's nothing wonky about it : ) And the odd behaviour indicates that the

[Proto-Scripty] Re: Prototype bug?

2009-02-10 Thread RobG
On Feb 10, 9:35 pm, Jim Higson j...@333.org wrote: On Feb 8, 1:19 pm, RobG rg...@iinet.net.au wrote: [...] It's a bit unfair to blame the language for what you consider an inappropriate use of one of its features.  Perhaps the name of the function should be isStringPrimitive. I guess I

[Proto-Scripty] Re: Prototype bug?

2009-02-08 Thread RobG
On Feb 8, 12:55 am, Jim Higson j...@333.org wrote: alert( Object.isString( foo )); // alerts string It alerts true. alert( Object.isString( new String( foo ) )); // alerts object It alerts false. I know why this happens - because Prototype uses the underlying typeof's understanding

[Proto-Scripty] Re: Prototype bug?

2009-02-08 Thread kangax
On Feb 8, 8:19 am, RobG rg...@iinet.net.au wrote: [...] It can hardly be called a bug when it does what the documentation says it does (I think works as designed is the polite response).  The function itself is a bit pointless though, as are similar functions like isNumber, e.g. It's not

[Proto-Scripty] Re: Prototype bug?

2009-02-08 Thread RobG
On Feb 8, 11:53 pm, kangax kan...@gmail.com wrote: On Feb 8, 8:19 am, RobG rg...@iinet.net.au wrote: [...] It can hardly be called a bug when it does what the documentation says it does (I think works as designed is the polite response). The function itself is a bit pointless though, as

[Proto-Scripty] Re: Prototype bug?

2009-02-08 Thread RobG
On Feb 9, 11:37 am, kangax kan...@gmail.com wrote: On Feb 8, 7:32 pm, RobG rg...@iinet.net.au wrote: On Feb 8, 11:53 pm, kangax kan...@gmail.com wrote: [...] It's not pointless, but the scope of its use is indeed pretty narrow. Can you provide a scenario where isNumber is more

[Proto-Scripty] Re: Prototype bug?

2009-02-08 Thread kangax
On Feb 8, 9:59 pm, RobG rg...@iinet.net.au wrote: On Feb 9, 11:37 am, kangax kan...@gmail.com wrote: [...] Of course. `isNumber` (as it is in a trunk) will return `true` for Number *object*, while `typeof` will obviously return object. Whether Number objects are something that should be

[Proto-Scripty] Re: Prototype bug?

2009-02-07 Thread Tobie Langel
That's been fixed in trunk. Best, Tobie On Feb 7, 3:55 pm, Jim Higson j...@333.org wrote: alert( Object.isString( foo )); // alerts string alert( Object.isString( new String( foo ) )); // alerts object I know why this happens - because Prototype uses the underlying typeof's

[Proto-Scripty] Re: Prototype bug?

2009-02-07 Thread kangax
On Feb 7, 9:55 am, Jim Higson j...@333.org wrote: alert( Object.isString( foo )); // alerts string alert( Object.isString( new String( foo ) )); // alerts object I know why this happens - because Prototype uses the underlying typeof's understanding of type. Personally I think this is a