Re: [RFC] Scalar Type Hints v0.2

From: Date: Thu, 15 Jan 2015 07:26:28 +0000
Subject: Re: [RFC] Scalar Type Hints v0.2
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-80516@lists.php.net to get a copy of this message
> On Wed, Jan 14, 2015 at 11:28 PM, Andrea Faulds <ajf@ajf.me> wrote: > From what I can see, the larger PHP community is generally in favour of strict typing, and > among them, the previous RFC revision was received quite poorly. Myself, I might have been somewhat > happy with just weak hints, but it would upset an awful lot of developers who would like some > measure of strict typing. Developers who would most likely not use the new scalar type hints, > because they weren’t strict. And if nobody uses them, why add them? Actually, what's the big difference, making weak typing worse and less useable? The people who write libraries are guaranteed either way that the input parameters for their methods will be of desired type in both cases. And the people who use them either can do the conversion themselves (in strong typing case) or let the language help with it for them (in weak typing case) - which is IMHO fine, as long as the conversions are kinda predictable and 100% documented. And yesterday I was pointed out one thing: the RFC states "With this approach, an argument is only accepted if its type is exactly the same as the parameter.". Does this mean you cannot pass integer to a function with float argument in the strict mode? Is it strong or strict, btw? I always thought it's supposed to be "strongly typed", but since I saw "strict typing" here used by everyone, I'm not sure now. Pavel Kouril

« previous php.internals (#80516) next »