Re: What do we need strict scalar type hints for?

From: Date: Tue, 03 Feb 2015 16:14:50 +0000
Subject: Re: What do we need strict scalar type hints for?
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-81724@lists.php.net to get a copy of this message
Hi Dmitry, > On 3 Feb 2015, at 04:07, Dmitry Stogov <dmitry@zend.com> wrote: > > I have similar opinion. Strict typing looks foreign for PHP. It is in a way, yes. PHP has traditionally been “weakly-typed” everywhere. That being said, we’re not always weakly-typed (there are strict type checks in some places), and userland code has sometimes done strict type checks anyway. > I see, strict type hints may be useful. > Aspecially for testing and error detection, but anyaway, I'm not sure if and how it should > be enabled. Declare() is a working solution, but it's not excelent. It’s not a perfect solution, but I haven’t seen anything that seems to be much better. The best bit about declare() is that it would make strict types completely optional, so people who don’t like them wouldn’t have to use them, even if they call code which does. -- Andrea Faulds http://ajf.me/

« previous php.internals (#81724) next »