Hi Levi,

On Sat, Feb 4, 2017 at 2:53 AM, Levi Morrison <le...@php.net> wrote:

> One more thing: I'd like to re-emphasize that the syntax that
> JavaScript uses and the one that HHVM/Hack uses are ambiguous in the
> current class of our grammar. The following will not work unless we
> move to a more powerful grammar and parser class:
>
>     (params) => expr
>     (params) ==> expr
>
> This is why an un-ambiguous prefix is necessary: the prefix breaks the
> ambiguities. The syntax I have suggested in the RFC and the one I
> suggested just now are not ambiguous because distinct prefixes:
>

Thanks for explanation.

> an un-ambiguous prefix is necessary

This is what I guessed.

This should be emphasized and everyone should understand.
Otherwise, discussion goes nowhere.


>     fn(params) => expr
>     |params| => expr
>
> I look forward to more discussion!
>

It's unfortunate we cannot have HHVM/Hack syntax now
https://docs.hhvm.com/hack/lambdas/introduction

but both
fn(params) => expr
|params| => expr
would be good enough for now. I don't see much problem with
|(int | float) params| => expr

It's better to be compatible with other implementations if it is possible.
PHP may have HHVM/Hack syntax support in the future.

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net

Reply via email to