Re: [RFC] Scalar Type Hints v0.2

From: Date: Wed, 14 Jan 2015 10:22:27 +0000
Subject: Re: [RFC] Scalar Type Hints v0.2
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-80455@lists.php.net to get a copy of this message
Hi Julien, > On 14 Jan 2015, at 10:14, Julien Pauli <jpauli@php.net> wrote: > > Using declare() IMO, is a PITA. > Everything that can be done without the use of declare(), must be done without declare(). > > I would have prefered different syntax, like the ones we disccussed many years ago , having > strict checks with the foo(string $a) syntax, and non-strict check with the foo((string) $a) syntax. Actually, this approach came about mostly to avoid that. I don’t really like the idea of mixing and matching weak and strict type checks. Having some functions using (int) and (string), others use int and string, and others still use both, would be confusing. Plus, it would mean that you’d be forced to follow the personal preference of the API authors. With this RFC, yes, you have to put an extra line at the top of the file. But it has the advantage that everything follows the same behaviour, even extension/built-in functions. That’s what I like about it. -- Andrea Faulds http://ajf.me/

« previous php.internals (#80455) next »