Re: [VOTE] Scalar Type Hints
| From: | Andrea Faulds | Date: | Thu, 05 Feb 2015 23:51:29 +0000 |
| Subject: | Re: [VOTE] Scalar Type Hints | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81982@lists.php.net to get a copy of this message | ||
Hi Dan,
> On 5 Feb 2015, at 23:41, Dan Ackroyd <danack@basereality.com> wrote:
>
> As much as I want scalar types I'm voting no as:
>
> i) Having this code:
>
> function foo(int $numberOfRightTurns) {
> $x = $numberOfRightTurns * 90;
> return sin(deg2rad($x))
> }
>
> work or blow up depending on a setting at the top of the file is horrible.
From what I’ve seen this is a rather uncommon case.
Also, that code only works for some integer values and not others: the strict version is uniformly
broken, the weak version is sometimes broken.
> ii) Having the code that I write in userland behave differently
> depending on how people call it, is also horrible.
Your code always behaves identically.
> Additionally Andrea, I am disappointed that you opened voting without
> a option with the 'declare' stuff removed. This is despite myself
> having asked you for an vote option for just strict types directly
> several times. Other people have asked for a vote option that allows
> strict and weak types with a different syntax.
Yes, I realise you and others have asked for such things. I disagree with you there and I don’t
think adding strict types to PHP is really a good idea. I’d prefer we have more rather than less
consistency between userland and internals.
> I realise that the RFC as it stands is your preferred option, but just
> not accepting feedback during an RFC is not appropriate.
I have listened to feedback. But listening to feedback and agreeing to any and all suggestions are
not the same thing.
--
Andrea Faulds
http://ajf.me/