All,

There's something that I think needs to be said about the now 3 scalar
type proposals. Please bear with me, there's a lot to say here. I'll
try to keep it as brief as I can.

I've been working off-and-on on scalar types for over 3 years. I've
officially proposed 3 proposals and have discussed and played with
many more versions. After I left, Andrea mentioned to me that she
wanted to pick one up. So I helped her. I worked with her for months
on what was ultimately withdrawn
(https://wiki.php.net/rfc/scalar_type_hinting_with_cast). At that
point I resigned to the fact that it wasn't possible to do scalar
types in PHP.

Andrea proved me wrong. When she came up with the dual-mode RFC in
0.3, it was the first proposal that either of us worked on that even
had a shot of passing. She put it up to vote slightly prematurely, but
the votes were pretty clear that it was basically what people wanted,
but with a few minor "issues". When she abandoned it, I picked it up.
Partly because I wanted to see it pass (I think it's the right
proposal), but partly because I didn't want to see her efforts go in
vain by people who didn't even understand the why.

So let me explain what I learned through that experience. Why I chose
to pick the dual mode RFC back up. Why I predicted the coercive mode
RFC would do so badly. And why I currently predict the basic scalar
type RFC, if voted on, would fail as well.

It comes down to what people want. It became quite clear early on,
that no matter what rule set you choose, there is a non-trivial amount
of people who want something else. This is life.

However, in this case, there are basically 3 camps:

1) Those that want purely weak types (what we have with ZPP now).
2) Those that want stronger weak types (similar to what the coercive
mode proposal does, but slightly stricter)
3) Those that want strict types.

Each of these three camps has a non-trivial amount of members (at
least 20-30%). Personal interactions that I've had suggest to me that
the largest camp is for strong types, but even if it wasn't, it's
still not trivial.

So what does that mean? Well, it means that no single mode proposal
can pass. Because any single mode proposal is 100% guaranteed to
alienate the needs/wants of at least 1, but more likely 2 of those
groups.

The current dual mode proposal is the only one that I've seen that
doesn't alienate groups. It gives the purely weak camp what they want
(and by default too). It gives the strict type camp what they want.
And it lets the stronger-weak-types group choose between the two as
they want/need. Is it a perfect proposal? No. But it works for
everyone, rather than against them.

Zeev mentioned on twitter yesterday that he wants to "at least try and
understand why people are voting no for it and turn it around" with
respect to his coercive proposal. Despite the fact that many people
have said in threads why they voted against it, let me say it again
here, really simply. There are two fundamental reasons people are
voting against it: 1) Backwards Compatibility and 2) It alienates the
needs of a portion of voters. And there's a deeper problem. In trying
to "clean up" the conversions, it partially makes it stricter than
some want (the purely weak group) and doesn't go far enough for those
that want stronger weak types. So it sits as a worst-of-all-worlds.

Bob's pure-weak proposal (which is basically 1/2 of the dual mode RFC)
seems like a great compromise. It's simple, easy to use, easy to
understand, and can be part of a stepping stone to future modes (a
strict mode can always be added later).

But that ignores that it doesn't give 2/3 of the people what they
want/need. It ignores that it actually makes it *less* likely for
those 2/3 to get what they want/need. Without the support of 2 of the
groups, it's unlikely that anything will ever pass. And a future RFC
to introduce a strict mode (after we have a weak mode) would be
unlikely to pass since it serves no benefit to the weak group.

So what effectively would happen is you'd get at least 1 of the groups
(the strict group) to vote against it. And you'd get at least a few
from the stronger-weak types group to vote against it. Meaning that it
would be hard to get it passed.

Scalar types are a **hard** problem. Not technically, but politically,
because so many people use PHP in different ways. And everyone thinks
their way is "the one true way". The dual-mode proposal is the only
one on the table that currently addresses the different needs of
different people.

Does that mean that a single-mode compromise is impossible? I wouldn't
use the word impossible, but I certainly would use improbable. We've
been talking about this for **years**. The chances are quite high that
if a good compromise existed, it would have been found. Instead, every
"compromise" that we've seen simply throws away the needs of an entire
group.

Should we clean up ZPP's parsing rules? Absolutely. "100 apples"
should definitely become an error. But the way to do that is not as a
last-minute change to the language rules. The way we should do that is
with MASSIVE testing to ensure that the breaks are well controlled and
warranted. This is not something that should be done in the 2 days
prior to freeze, but should be planned an executed in a really clear
timeline. Perhaps that's a good goal for 7.1 or 8.0.

But for today, I firmly believe that the Dual-Mode proposal is the
only one that stands a chance of passing. I think it's the best chance
for the language, and it's the only one that tries to unite the
different usages of PHP into a single group, rather than alienating
users.

I respectfully ask Zeev to retract his current proposal as it's
currently failing with 68% of voters voting against it (currently
16:34). Without extending the timeline for 7, there's very little
chance of it passing. So rather than dragging out the entire process
needlessly for 2 more weeks, can we just finally be done with it?

Thanks,

Anthony

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

Reply via email to