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

Miklos Tirpak miklos at iptel.org
Tue Apr 28 09:53:26 CEST 2009


On 04/27/2009 04:18 PM, Juha Heinanen wrote:
> 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.

yes, this is really strange indeed. And ("abcd" == undef) is also true 
according to the table.

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

I agree.

Miklos

> 
>  > $foo == 0       true    true    true    true    false
> 
> again "" == 0 makes no sense.
> 
> -- juha



More information about the sr-dev mailing list