> I don't see the current PHP type juggling as 'formal programming'. It
makes
> things easy but can also lead to bugs where unexpected values (& so
types)
> end up being inappropriately used.

I haven't yet reviewed the conversion table in detail, but unless I'm
missing something, this RFC is in fact much more in the spirit of PHP -
and implements type juggling - unlike the previous incarnation of strict
typing that almost made it into PHP.  It's a bit too strict to my liking
(especially around conversion of floating point to int, which should pass
and perhaps generate a notice IMHO), but this is a big step towards the
spirit of what I proposed together with Lukas back in 2010
(https://wiki.php.net/rfc/typecheckingstrictandweak) - which was an
alternative to the strong typing suggested by several others.


Type juggling is an *inherent* feature of PHP.  Paraphrasing what Rasmus
said several years ago(*), 'if you implement this [strong typing], please
don't call it PHP'.

Again, luckily, what Andrea proposes isn't strong typing.  It still
maintains the most important properties of type juggling - e.g. the
ability to work with strings coming in as input (GET/POST/etc.) without
having to worry about typing.

Zeev

(*) I couldn't find that email quickly enough so apologies if I'm not
completely accurate on this.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to