[SR-Users] how can string "0" be equal to int 0?

Daniel-Constantin Mierla miconda at gmail.com
Fri Oct 15 16:48:16 CEST 2010


  Juha,

On 10/15/10 4:32 PM, Juha Heinanen wrote:
> daniel,
>
> after your rant,
rant?!? maybe you got the message wrong. It was about the purpose of 
configuration file and the target users for it.

>   please tell a non-programmer, how he/she can easily
> test if a var holds integer 0 value?
I don't see the relation of this question with auto-conversion debate 
and type checking.

The variable is set somehow, either taken from database of directly in 
config. Who does the logic know what comes there. If I do $var(x) = 1; I 
know it is integer. I haven't found a need to test the type of variable 
so far, but, if someone has an there is no function for finding out the 
type of value, it can be written. Avpops module has one for avps, but I 
haven't heard many using it -- in the beginning people use it to test if 
avp is set or not, now everyone is testing against $null.

So, really, this is not anything like flame war, just making sure we 
don't rewrite c interpreter, because nobody is going to use it.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://www.asipto.com




More information about the sr-users mailing list