Re:Do I really want to be using a language where memoize is ...
by donw on Tuesday July 20, 2010 @08:27AM
(#1531821)
I've heard of duck-typing, and static-typing, but this is the first time I've heard of Schrödinger-typing...
Re:Do I really want to be using a language where memoize is ...
by gtani on Tuesday July 20, 2010 @10:39AM
(#1532183)
Yeah, Appendix A Crockford's "Good Parts" (could be Appendix B, I can't remember. The book's so small I can't find it.
Re:Do I really want to be using a language where memoize is ...
by sesqu on Tuesday July 20, 2010 @02:33PM
(#1533003)
> Boolean([])
true
> []==false
true
> [] == ![]
true
How the hell does that work? Aren't all non-booleans implicitly cast?edit: rephrased
Re:Do I really want to be using a language where memoize is ...
by chc on Tuesday July 20, 2010 @03:42PM
(#1533224)
It's because the == operator converts its arguments to be of the same type, and it does so in a rather unintuitive way. This makes it both inefficient and frequently baffling. You pretty much always want === instead, which does not allow comparisons between different types.
So it isn't intuitive to you that an empty object and array should both evaluate to true, but neither are equal to true, the empty array is equal to false, and the empty object is neither equal to true _or_ false?