> -----Original Message-----
> From: Andrea Faulds [mailto:a...@ajf.me]
> Sent: Thursday, January 15, 2015 4:51 PM
> To: Zeev Suraski
> Cc: rquadl...@gmail.com; Leigh; PHP Internals List
> Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints v0.2
>
> Hi Zeev,
>
> > On 15 Jan 2015, at 14:32, Zeev Suraski <z...@zend.com> wrote:
> >
> >> 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.
> >
> > That's correct.  As I said though, the source of the opposition is
> > fundamentally different.
> > The camp which opposes weak typing opposes it based on the idea that
> > it doesn't behave in the way that would suit their needs.
> > The camp which opposes strict typing - which incidentally includes
> > most of the people who originally created the language - opposes it
> > based on the assertion that it goes against the spirit of the
> > language.  That is equally true for the v0.2 proposal you've just
> > submitted.
>
> I’m not really sure this is true. I agree that strict types aren’t
> entirely in
> keeping with the “PHP way”. However, there are plenty of people who are
> against them not for that reason, but simply because they don’t work well
> for them. Plus, I’m not sure strict typing causes as much of a problem if
> it is
> off by default. Nobody is forced to use it, the language would stay
> beginner-
> friendly and weakly-typed. Indeed, strict type hints don’t stop PHP being
> weakly-typed. They just check types at function call boundaries. Think of
> it as
> a sanity check.
>
> >
> >>> 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.
> >
> > Of course not all of it was positive, but it was overwhelmingly
> > positive.
> > Very few opposed.  Someone saying they won't use it doesn't count as
> > opposition.
>
> Let’s have a look. From a quick skim over the thread for v0.1:
>
> * In favour of weak types (or the RFC anyway): Adam, Stas, yourself,
> Jordi,
> Pierre,

You're definitely missing Dmitry (which helped with the RFC) as well as
Xinchen and Arvids from today.  From past experience I believe Rasmus too.

> * Against, in favour of strict types: Maxime, Nikita, Markus, Marco,
> Leigh,
> Levi, Sven(?)

As far as I recall (maybe I'm wrong) the only one here that outright opposed
was Nikita.  Others suggested ways to improve it but didn't really oppose
it.

> This is unlikely to be super-representative of the PHP community. However,
> I’m not sure I’d say “overwhelmingly positive”. It can be easy to get
> confirmation bias when reading RFC threads.

Fair enough.

> It is very clear to me that a lot of people would like strict types, and
> some
> people would like weak types. As to their relative numbers, I cannot say.

Well, that's clear bias right here too - 'a lot' vs. 'some'.  Again, I don't
think you have a way of knowing it and based on my experience the opposite
is true - but none of us truly knows.  Either way, the former goes against
what we created PHP around, while the latter does not.

> I don’t think it’s really fair to cover only the use case of one half of
> the PHP
> community. The other half counts too. This is a rather divisive issue.

I disagree.  PHP has never been about everything and the kitchen sink.  Not
only do we not strive to support everyone's taste, we actually try not to,
and be somewhat opinionated on how things should be done.
This issue is primarily divisive among the inner core of the PHP userbase,
hardly around the millions of users out there.

> >  You see, PHP exists for 15-20 years now.  There aren't any must-have
> > features that aren't in it.  No single feature we add will be used by
> > everyone, and people telling us they won't use this feature shouldn't
> > 'deter' us in any way.
>
> I don’t think this is true: if we are making a feature less useful (and
> therefore
> making many people avoid it), it’s worth considering if that is a problem.
> If
> we can easily cover the vast majority of people’s use cases, rather than
> catering to only one group of people (who may or may not be the majority),
> why don’t we?

For the same reason we didn't introduce strict types in the countless times
it came up in the past - it goes against the language's principles.

> Except that is not the case for this proposal, which explicitly and
> deliberately
> prevents the directive affecting inclusion. The behaviour is impossible to
> toggle at runtime, unless you’re using some weird extension which lets you
> edit the flag on the ZEND_DO_FCALL opcode.

Fact is that people who run websites where they don't care about strict
typing, can end up viewing strict type failures coming from code they don't
own, which would make the app fail 'catastophically' and unpredictably.
You'd have no way to turn it off (without diving to and changing the file in
question) - because it's the code itself that turns it on - and from the
user's point of view, for all practical purposes, at runtime.

I agree that the scope of breakage of using a local file definition is much
reduced compared to an INI entry, but it's still there.

Zeev

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to