|
Posted by Rik on 05/29/06 03:46
Norman Peelman wrote:
> The bottom line is that '.' and '+' are/were not really meant to be
> used at the same time as one works with strings and one works with
> mathematics. So normally there would be no ambiguity. Type casting
> 'allows' it to be done so that someone who has an understanding of
> what's going on can proceed without having to use/write functions to
> convert strings and numbers back and forth.
I think that's the major point here:
typecasting vs. clear operations
One excludes the other in may occasions. PHP is very forgiving, allowing
floats, expontentials etc, but eval()ing strings using some mathmetical
parser before mathmatical equasions is to much to ask.
If one wants a pure, clear language, the parser should break at the
operations stated eralier, issuing a warning that 'something' isn't an
number (float, integer etc.), or 'something' isn't a string.
That would have a purity I can appreciate, allthough always casting posted,
get, database queried, filtered, or however one gets data, to a number will
be such a big pain, I do think PHP has it right with introducing some
leniency. The distance that leniency goes is the programmers responsibility
to learn, the consequences of that leniency are the programmers choice.
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|