[SR-Users] how can string "0" be equal to int 0?
Daniel-Constantin Mierla
miconda at gmail.com
Fri Oct 15 17:04:07 CEST 2010
On 10/15/10 4:36 PM, Andrei Pelinescu-Onciul wrote:
> On Oct 15, 2010 at 16:26, Daniel-Constantin Mierla<miconda at gmail.com> wrote:
>>
>> On 10/15/10 1:43 PM, Juha Heinanen wrote:
>>> Daniel-Constantin Mierla writes:
>>>
>>>> I don't think a strict type checking is suitable for configuration file
>>>> - e.g., if I want to check value in cseq, don't want to get lost in type
>>>> conversions.
>>>>
>>>> If there is going to be such error messages, they must be enclosed in a
>>>> config parameter.
>>> yes, there could be a config parameter
>>> "warn_about_implicit_type_conversions" or something like that. i would
>>> definitely turn it on, since it would not be a big deal for me to add
>>> (int) or (string) in front of a variable when i want type conversion to
>>> be done in order to avoid config mistakes that get unnoticed.
>>
>> At the end of the day, one can write entire routing logic directly
>> in C code.
>>
>> Config language is complex enough, adding such things to it will
>> make it really unusable. Bear in mind that config is for sys admins
>> not for programmers. They operate the platform, then should care
>> only of SIP layer (which is alone difficult enough), not typed of
>> variables and heavy programming languages.
>>
>> Btw, what mistakes really can happen? That string "0" is equal with
>> 0? It is this way for so many years now.
>>
>> Either we focus to make the config file easier to understand and
>> use, or drop it and tell everything has to be written in C and the
>> 50-100 of us, developers, will use it.
> Actually there is a more dangerous thing here. All this nice features
> might hide script errors up to runtime. With a more strict type checking
> (and different operators for ints and strings), much more checking can
> be done at startup. In my opinion this would be more user friendly, then
> allowing everything and try to guess at runtime what the user really
> wanted. It's much more important to make sure the script is ok before
> starting, then to save someone some typing.
>
> Regarding this case, I agree that changing it now for 3.1 is a bad idea
> and this is also not the best example of how things could go wrong.
>
Andrei,
besides that bad things can happen always :-) , so far nobody complained
about such cases, but about complexity to understand and build
configuration files.
If we make it more C like, for sure won't get new people or businesses
jumping in. Paying a programmer for sysadmin job won't work, maybe not
only because of money, but because of people's own expectation. And
perhaps is were we get in the trap, we are programmers and we would like
to be same, but as said in the previous email, we end up to close a
circle of 50-100 people.
From the first time avps were introduced that they can hold string or
integers. xlog introduced specifiers holding all the time strings and
later used for pseudo-variables, that is more than 5 years ago and all
went fine so far.
Changing current behavior will be killing, using new operators (iirc,
you added something with le, lt, ...) would be an option, but we add
more to the confusion of what and how to use.
Cheers,
Daniel
--
Daniel-Constantin Mierla
http://www.asipto.com
More information about the sr-users
mailing list