At 11:39 09/07/2009, Paul Biggar wrote:
I believe nearly all opinions voiced have wanted the current patch.
Many more were in favour of strict typing only, but for the few
dissenters, like myself, Ilia included casting semantics using (int)
syntax.
I think that many of the people who expressed
support for that patch did not fully realize its
implications - much in the same way they weren't
quite realizing they're actually voting for
inclusion in PHP 5.3. I believe that if we had a
'clean' Weak typing RFC as well as a Strict
typing RFC, each with its pros and cons - there
would be very different results.
There are I think maybe 5 or 6 people who have expressed opinions
against this. All others have been pro (I'm not counting the vote
here, I'm looking at discussions).
I think you're right, but I also think it had to
do with dynamics more than with actual content.
The two approaches were never compared
head-to-head, with the pros and cons - and more
importantly - with use cases on why strict typing
is necessary despite the fact it's fairly 'alien' to PHP.
> 2. Â Make sure people understand *why* we're
implementing it - performance is
> certainly *not* the reason.
I believe there was only two misguided souls who believed this would
lead to better performance. Everyone else wanted it on its merits.
Maybe - but the only way to make sure is to make it a clear part of the RFC(s).
It doesnt sound like you are aware of the casting semantics that Ilia
added. They are largely consistent with the internal function
semantics.
function x (int x) { /* fail on non-int */ }
function x ((int) x) { /* cast parameter to an int */ } // just like
internals functions
I am - and I think I like this even less than
pure strict typing because of increased WTF factor.
I think strict typing is wrong for PHP, and this
cannot be fixed by also adding something
else. The way to 'fix' this is by not adding
strict typing, and adding only weak typing.
Indeed this adds the ability to make your function work like an
internals function (useful perhaps for library interfaces).
If improved with slightly more intrusive checks
(like the ones suggested in my email) - then it
can be useful in mostly all of the places where strict typing would be used.
> I think we can take Lukas's RFC and either change it or write something
> based on it for weak typing only. Â If people here find it useful I'll go
> ahead and do that.
I believe people don't want this. I wrote a set of rules, Lukas wrote
the RFC, and neither got anything like the support that strict typing
got.
This could be for a variety of reasons - one of
them is that people truly thought this through
and truly prefer strict typing to weak
typing. But that is just one of the
options. Another is that the difference between
the two approaches, as well as the issues with
strict typing - aren't fully understood by the
audience - and I believe that this is actually the case.
One large problem is that it introduced a new 3rd set of rules, and
this set is not intuitive but rather slightly subjective (reasonable
people might disagree on whether a bool should be weakly converted to
an int, for example). The strict type checks are at least simple, and
the current weak ones are what people are used to.
I definitely don't think we should add two new
semantics. Ideally we shouldn't add any
entirely-new semantics, and what I'm proposing is
to actually reuse the existing semantics for
internal functions - with very minor
modifications. Kind of like Semantics and
Semantics', rather than Sematnics1, Semantics2, Semantics3.
Obviously I'm not against discussion, but we just had this discussion.
Given the implications of introducing something
like that (that can easily grow in the future to
other parts of PHP) - and my belief that the
discussion missed key ingredients, we should discuss it further.
We need to go back to the fundamentals - and look
for use cases where strict typing would be
substantially superior to weak typing. As far as
reflection, code readability, optimization and
security is concerned - I can't find any
superiority, but maybe I'm missing something. We
already have an RFC that details the
disadvantages of strict typing (Lukas's
RFC). Let's focus on the advantages and see if they're worth it?
Zeev
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php