My philosophical problem with the undefined value led me to look
better at the + and - operators.
The code is ugly, so I decided to rewrite it in a simpler way.
The big question is: what do we do when we have heterogeneous
arguments?
For +, the (current) result is a string as soon as one argument is a
string.
e.g. "x" + 3 = "x3" and 3 + "x" = "3x"
This also means that "123" + 7 = "1237"
For -, the behavior is identical, although I am not sure it is a good
idea, because "string subtraction" is a rather special operation.
Maybe after we should just print a warning and returns an error (null)
but I suspect that this would break a couple of scripts.
--
mailto:arboi@alussinan.org
GPG Public keys: http://michel.arboi.free.fr/pubkey.txt
http://michel.arboi.free.fr/ http://arboi.da.ru/
FAQNOPI de fr.comp.securite : http://faqnopi.da.ru/
better at the + and - operators.
The code is ugly, so I decided to rewrite it in a simpler way.
The big question is: what do we do when we have heterogeneous
arguments?
For +, the (current) result is a string as soon as one argument is a
string.
e.g. "x" + 3 = "x3" and 3 + "x" = "3x"
This also means that "123" + 7 = "1237"
For -, the behavior is identical, although I am not sure it is a good
idea, because "string subtraction" is a rather special operation.
Maybe after we should just print a warning and returns an error (null)
but I suspect that this would break a couple of scripts.
--
mailto:arboi@alussinan.org
GPG Public keys: http://michel.arboi.free.fr/pubkey.txt
http://michel.arboi.free.fr/ http://arboi.da.ru/
FAQNOPI de fr.comp.securite : http://faqnopi.da.ru/