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

Juha Heinanen jh at tutpro.com
Fri Oct 15 17:03:54 CEST 2010


Daniel-Constantin Mierla writes:

> rant?!? maybe you got the message wrong. It was about the purpose of 
> configuration file and the target users for it.

your message was very emotional.  you defined the target users in your
message.  i have not seen that discussed or agreed earlier.  my claim is
that current config language very much resembles a programming
language.

> >   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.

it has, because if target is a non-programmer, then it should be very
easy to do.  that was the problem where this whole discussion started.

> 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.

here is a real world example for you: make a single htable query and
find out, if the resulting value is string "0" or if there was no result
at all.  for performance reasons i don't accept answer where the query
is done two times.

> 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.

you are exaggerating.  there is big difference between type safety and c
language programming.

-- juha



More information about the sr-users mailing list