2010/8/12 Zeev Suraski <z...@zend.com>:
> At 04:02 12/08/2010, Josh Davis wrote:
>>
>> What would be interesting to see is what people think of Derick's
>> latest proposal allowing both the strict typechecking and the more
>> sensible "weak typing"
>
> Everyone who opposes strict typing on grounds that it's an alien
> feature to PHP(*) doesn't see any advantages in this suggestion, as
> everything that's bad in strict typing remains on the table.  If there were
> only two options left on earth, strict typing and strict+auto-conversion,
> I'd vote for going with just strict.

Who appointed you the official anti-strict ambassador? If there really
are so many people who think it's the worst idea since the dawn of
mankind, it will be revealed when it's inevitably time for a vote.

Perhaps if you stopped pretending to know everybody's opinion, it
would be easier finding a consensus. Unless someone expressed their
opinion, it is *unknown*. Stick to expressing your *own* opinion.

I don't see any reason why we can't provide "smartcast" for when the
API provider cares about the value *and* "strict typing" for when the
API provider cares about the data type.

Providing both options instead of only strict is entirely different.
If there is only strict, then that is the only option the PHP users
have if they want type hinting (yes, incorrect term, yadda yadda). If
both are available, people still have the option to use strict in the
specific use cases where they need it, but use smartcast otherwise.

If you don't like "function foo(int $i)" (strict) vs. "function
foo((int) $i)" (smarcast), it could just as well be "function foo(int
$i)" (smartcast) and "function foo(+int $i)" (strict, other char than
"plus" could possibly be used). This has two benefits to the former
syntax choices:
1) The smartcast syntax would be consistent with how the APIs are
documented in PHP's documentation, so the syntax in PHP would not
conflict.
2) "+int" isn't used anywhere, so it's obvious that it's something
different and it's easy to see in API documentations, auto-completion,
etc.

-- 
Daniel Egeberg

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

Reply via email to