2012-08-23

mixing strings and numbers

7.17: adda/type/mixing strings and numbers:
. suppose the (+)-opererator can be used for
both addition and concatenation;
if we have to eval (string + number),
then the coercion should be to string,
since every number has a string image,
but not every string can eval to a number;
therefore, we should have it so that
if user is expecting coercion to number,
then explicit conversion would be required;
ie, the compiler is converting (str+num)
to ((str + num as string))
but, such conversion can be done implicitly
by typing-casting either the
source or the destination
(and all adda symbols must be
typing-casted when declared
although the escape hatch is tall.type
-- pointer To ALL types having a supertype.tag ).
eg, num.number; num`= str + num
is converted automatically to:
num.number; num`= (str as number) + num .
. also,
num`= (str + num) as number
is automatically understood to be:
num`= (str as number) + num .