Re: [RFC] Scalar Type Hints v0.2
| From: | Andrea Faulds | Date: | Thu, 15 Jan 2015 14:09:35 +0000 |
| Subject: | Re: [RFC] Scalar Type Hints v0.2 | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80537@lists.php.net to get a copy of this message | ||
Hi Zeev,
> On 15 Jan 2015, at 11:56, Zeev Suraski <zeev@zend.com> wrote:
>
> Andrea,
>
> I'm not sure what you're basing that assumption on. The incidental
> interactions you (or anybody) may have with 'the community', by no way
> represent the opinion of the community at large. The vast majority of the
> PHP community never ever interacts with internals@, never attend
> conferences, don't write blog posts about PHP and are generally completely
> 'under the radar'. I would actually go to argue that the people who do
> attend conferences, participate on internals@ or write blog posts - are not
> representative of the PHP userbase at large. The vast majority of
> developers I bump into - you will never ever hear from. They constitute the
> vast majority of the ~5M strong PHP developer base.
>
> So even though my belief / educated guess is that the vast majority of the
> PHP userbase would prefer to see strict typing kept off this language, I'm
> not going to argue that - but we must not argue the opposite either, based
> on the non-representative anecdotal data from a few dozen people.
Whether or not they are in the majority, a very large portion of PHP developers would prefer strict
typing. In particular, the most vocal ones would seem to. There are also a lot of PHP developers who
would prefer weak typing. Thus we have a problem: either approach to scalar hints will upset a large
portion of the community.
>
>> 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?
>
> How do you deduce that 'nobody uses them' from the fact that some group of
> people said they won't? I'm sorry, but it makes no sense, especially given
> the positive feedback you saw on internals, making it clear that there would
> be in fact people using it.
Not all of it was positive. Sure, a lot of people would use them though, but I’ve heard quite a
few developers say they wouldn’t use them and continue to use manual (!is_int($foo))-style
assertions.
> If there's one thing that's worse than introducing an alien concept like
> strict typing into PHP, it's introducing it as a feature that will include
> all the negatives of this alien concept, PLUS have the ability to radically
> change how it behaves based on a runtime option.
This isn’t a runtime option, it is entirely compile-time. Much like namespaces are not a runtime
option. There isn’t even the ability to toggle it at runtime, unless we somehow add some ability
to edit the flags on individual opcodes.
Thanks.
--
Andrea Faulds
http://ajf.me/