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

Daniel-Constantin Mierla miconda at gmail.com
Fri Oct 15 17:21:35 CEST 2010



On 10/15/10 5:03 PM, Juha Heinanen wrote:
> 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.

well, somehow is what I see everywhere I deal with. Barely found 
programmers to manage operational systems, being it web servers, mail 
servers, voip servers, a.s.o.

>    my claim is
> that current config language very much resembles a programming
> language.

That is quite some problem imo, so instead of make it more complex, I 
will try to reduce it complexity and make it more use friendly.

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

I don't think the target is to have a generic programming language, 
where the admin doesn't know what comes and from where, so it has to do 
a lot of checks to find out.


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

Yet the performance is another topic. How much penalty a htable query 
could bring? If you look into the c code of many functions there are lot 
of too many safety checks that can be removed. I think we can do more 
processing than the pipe can handle.

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

This is one step in that direction rather than opposite. So my concern 
was not to end up rewriting it.

Cheers,
Daniel

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




More information about the sr-users mailing list