Re: Types on the right or on the left
| From: | Andrea Faulds | Date: | Tue, 04 Nov 2014 18:40:35 +0000 |
| Subject: | Re: Types on the right or on the left | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78668@lists.php.net to get a copy of this message | ||
> On 4 Nov 2014, at 18:33, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
>
>> 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.
>
> What's "normal function" and why it would have to have "Foo" after
> function? What's wrong with "Foo function bar()"? It reads nicely (at
> least in English, where the natural word order is adjective-noun, not
> noun-adjective), it does not disrupt any searches, what exactly is wrong
> with it?
I suppose it’s alright for normal functions:
Foo function foo() {
}
But it’s rather weird for closures:
$foo = Foo function () {
};
It’s probably doable from a parsing perspective, but it seems really off to me. Having this return
type at the start of the expression doesn’t make sense to me.
But this whole discussion is a little pointless given it’s not what will actually be in PHP.
--
Andrea Faulds
http://ajf.me/