[SR-Dev] new operators & if($v) behaviour

Juha Heinanen jh at tutpro.com
Mon Apr 27 16:18:07 CEST 2009


Andrei Pelinescu-Onciul writes:

 > We could try some sane defaults (for if ($v)).

yes, in case there are some.

 > For example that's what perl does:
 >             undefined   ""      string  0       other integer
 > 
 > $foo eq undef   true    true    false   false   false
 > $foo == undef   true    true    true    true    false
 > 
 > $foo eq ""      true    true    false   false   false

if $foo is undefined, it is insane to me that it would be equal to empty
string "" or 0.  also comparing two undefined things should not result
in true.

what would make sense to me is that comparing an undefined thing to
anything that is defined, would result in false.

 > $foo == 0       true    true    true    true    false

again "" == 0 makes no sense.

-- juha



More information about the sr-dev mailing list