Hi,

On Mon, Sep 21, 2015 at 9:59 PM, Bob Weinand <bobw...@hotmail.com> wrote:

> So, before I start the vote, just two quick notes:
> I've added two notes about the statement syntax and the single variable
> use.
> Though a few people complained, I'm not switching to the ==> operator, as
> I noticed many people expected typehints to work (they don't due to parser
> limitations) when they compared to Hack's short Closures. It also allows us
> to differ syntax-wise [e.g. for typehints] from Hack without causing any
> confusion later. Which should be the smartest choice: Avoid conflicts. (If
> anyone strongly feels against that, he may vote no, but I would like to not
> bikeshed that in this Vote thread, but leave it free for eventual actual
> issues.)
>

I voted "no" because I'm against the automatic use () and introducing a new
symbol.

An earlier short closure RFC [1] supports explicit import, and I would want
to see explicit import mandated.  And rather than inventing a new symbol,
why not just re-purpose 'as' in this context?

function sumEventScores($events, $scores) {
    $types = array_map($event as $event['type'], $events);
    return array_reduce($types, ($sum, $type) as $sum + $scores[$type]);
}

'use' is already purposed in three places, I don't see why 'as' can't also
be in three places.  Though I've not checked the engine source to see the
actual effort, so this just may be astronaut architecting.

Anyway, thanks to Bob for his hard work pulling this together and everyone
for arguing it out.  That's what makes PHP great.

Sincerely,
bishop

[1]: https://wiki.php.net/rfc/short-syntax-for-anonymous-function

Reply via email to