Re: Type hinting

From: Date: Thu, 27 May 2010 11:18:24 +0000
Subject: Re: Type hinting
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-48508@lists.php.net to get a copy of this message
At 14:09 27/05/2010, Ilia Alshanetsky wrote:
Because auto-conversion is magic and like any magic causes in-consistent behaviour and what I like to call WTF factor, which means the developer is not quite certain what is going on. With strict type hints the behaviour is consistent every-time and there is no ambiguity of function.
PHP is a lot about magic, about the thing the language does for you that you don't have to worry about. Memory management, type juggling, letting your overload function calling and property lookup, etc. - all fall in that category. There'll be clear rules as to how type hints would work - it's not as if there'd be a random element to it. Are you also against __toString()? That's magical at exactly the same level. You can view PHP's scalars as data types that have __toString(), __toInt(), etc. It's exactly the same. Zeev

« previous php.internals (#48508) next »