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

From: Date: Wed, 04 Feb 2015 11:02:35 +0000
Subject: Re: What do we need strict scalar type hints for?
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-81808@lists.php.net to get a copy of this message
Hi Leigh, Le 4 févr. 2015 11:50, "Leigh" <leight@gmail.com> a écrit : > > What was wrong with: > > function x(int $y, string $z) { // strict > function x((int) $y, (string) $z) { // casting > > This was the best suggestion I've seen that covers the requirements of > both camps, and is still very clear how data is going to be handled. > > Authors who want their APIs to adhered to strictly can do that, > authors who want to accept anything and have it end up as their > desired type can do that too. Because it is then the callee who decides, not the caller, whether or not he wants strict typing. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > Cheers, Florian Margaine

« previous php.internals (#81808) next »