Re: AW: [PHP-DEV] Types on the right or on the left
| From: | Stas Malyshev | Date: | Tue, 04 Nov 2014 08:51:11 +0000 |
| Subject: | Re: AW: [PHP-DEV] Types on the right or on the left | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78618@lists.php.net to get a copy of this message | ||
Hi!
> put types only on the right, or only on the left or mix it. I
> followed the return type RFC and thus know that many people think it
> has to be on the left hand side. Fair enough, I do not have anything
> against such a decision. I also have nothing against putting the type
> on the right hand side. What merely bothers me is that it would be
> another inconsistency in the language design. It's not very intuitive
> for a user if a type hint is once on the right hand side and once on
> the left hand side.
I agree, this is not a very good situation. It would be much better to
take a systematic approach to this, but this is impossible since there
is no systematic approach to strict typing in PHP, just some pieces here
and there. I think this is not right, but obviously many people here
disagree and are happy to have the inconsistent syntax. I don't see why
"public Foo function bar()" would be so much worse than "public function
bar() : Foo" but for some reason this possibility wasn't even
considered as far as I can see.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/