Browse code

news: update (new operators, expr. eval behaviour a.s.o.)

Andrei Pelinescu-Onciul authored on 28/04/2009 17:54:03
Showing 1 changed files
... ...
@@ -6,6 +6,33 @@ $Id$
6 6
 sip-router changes
7 7
 
8 8
 core:
9
+  - new operators eq, ne for string compares and ieq, ine for interger 
10
+    compares. The names are not yet final (use them at your own risk).
11
+    Future version might use ==/!= only for ints (ieq/ine) and eq/ne for
12
+    strings (under debate).
13
+    They are almost equivalent to == or !=, but they force the conversion 
14
+	of their operands (eq to string and ieq to int), allowing among other
15
+	things better type checking on startup and more optimizations.
16
+    Non equiv. examples: 0 == "" (true) is not equivalent to 0 eq ""
17
+    (false: it evaluates to "0" eq ""). "a" ieq "b" (true: (int)"a" is 0
18
+     and (int)"b" is 0) is not equivalent to "a" == "b" (false).
19
+    Note: internally == and != are converted on startup to eq/ne/ieq/ine 
20
+    whenever possible (both operand types can be safely determined at
21
+    start time and they are the same).
22
+  - try to guess what the user wanted when operators that support multiple
23
+     types are used on different typed operands. In general convert the
24
+     the right operand to the type of the left operand and then perform the
25
+     operation. Exception: the left operand is undef.
26
+     This applies to the following operators: +, == and !=.
27
+     Special case: undef as left operand:
28
+     For +: undef + expr -> undef is converted to string => "" + expr.
29
+     For == and !=:   undef == expr -> undef is converted to type_of expr.
30
+     If expr is undef, then undef == undef is true (internally is converted
31
+     to string).
32
+  - expression evaluation changes: auto-convert to interger or string
33
+     in function of the operators: 
34
+       int(undef)==0,  int("")==0, int("123")==123, int("abc")==0
35
+       str(undef)=="", str(123)=="123".
9 36
   - new script operators: defined, strlen, strempty
10 37
       defined expr - returns true if expr is defined, and false if not.
11 38
                      Note: only a standalone avp or pvar can be