On 11-12 22:01, Andrei Pelinescu-Onciul wrote:
It would be better to have different operators for strings and for
integers. Right now we have '+', '==' and '!=' that can be used
both for
strings and integers. The problem with this approach is that it makes
some optimizations impossible, especially when combined with dynamic
typed variables (avps or pvars). '+' is especially bad because one
can tell what type ($v + x) has only at runtime.
I would like to preserve the original behaviour for strings. They are used
much more often than integers. If you need to change anything then, please,
consider changing the behaviour of integer operators.
I think having perl like operators would help a
lot:
- '.' for string concatenation (instead of reusing '+'), e.g.:
$v= "foo" . "bar"
Yes, I like this one.
- 'eq' instead of == for strings, e.g.:
$v eq "bar"
- 'ne' instead of != for strings, e.g.: $v ne "bar"
I don't like this. If there really is a need to have separate operators then
use 'eq' and 'ne' for integers and keep == and != for strings. Test
(see man
test) has string and integer operators this way.
I was using perl as a guideline (since we already have perl like stuff,
like ~=).