Re: Types on the right or on the left
| From: | Andrea Faulds | Date: | Tue, 04 Nov 2014 18:08:15 +0000 |
| Subject: | Re: Types on the right or on the left | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78656@lists.php.net to get a copy of this message | ||
> On 4 Nov 2014, at 17:46, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
>
> Hi!
>
>>> "public Foo function bar()" would be so much worse than "public function
>>> bar() : Foo"
>>
>> Because when you grep for "function bar", in future you'd have to know
>> the return type too.
>
> Sorry, I do not understand - why to grep for "function bar" you'd have
> to know the type? Just grep for "function bar" as you did before.
Because if that function has a return type, e.g.:
public function Foo bar()
Then you couldn’t grep for “function bar” because of the Foo.
If we used this syntax instead, which wouldn’t disrupt grep:
public Foo function bar();
It’d be inconsistent with normal function declarations which would have to have Foo after
function.
--
Andrea Faulds
http://ajf.me/