miconda left a comment (kamailio/kamailio#4444)

The variables framework was designed first for xlog module, and because of that 
most of them hold the string value even when the type is int. Furthermore, when 
there is an internal mapping between some string names (like protocol names: 
"udp", ...) and integer ids (like protocol ids: PROTO_UDP, ...), the 
implementation can hold the string name and interger id inside the same 
variable.

Probably it is confusing if you try such kind of evaluation as `$vn(isTLS) = 
$rP == "tls";` vs `$vn(isTLS) = "tls" == $rP;`, the scripting language 
interpreter tries to autoconvert right-side of an expression to the type 
discovered for the left side. This allows to concatenate strings with numbers 
and add/substract/... to a number an auto-converted value from a string. This 
is common for many scripting languages.

I am open to discuss what can be done better and review any PR that could try 
to make it clearer, but auto-conversion based on left-side type is useful. 
Anyhow, I added the topic to the upcoming Kamailio Developers Meeting, so we 
can discuss it there as well if nothing is done before:

  - https://www.kamailio.org/w/developers-meeting/

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4444#issuecomment-3431353553
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/4444/[email protected]>
_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to