On 6/5/2017 8:36 PM, Rasmus Schultz wrote:
> Ugh, you're right, that's totally unreadable... the => is far too ambiguous
> with array syntax, I agree.
> 
> How about just a thin arrow?
> 
>     (params) -> expr
> 
> If the parens around params were required, it's not ambiguous with the
> trailing -- operator, is it?
> 
>     $foo->bar(($baz) -> $baz + 1);
> 
> Consistent use of parens around the params might make closures a bit easier
> to spot in the wild?
> 

This would actually work with everything, me likes.

  () -> 42
  ($a, $b) -> $a + $b
  ($a) (&$b) -> $b += $a

  public static Foo() -> new static('Foo');

It also avoid any association with <?= which prints, not returns, and
any other assignment related thing.

-- 
Richard "Fleshgrinder" Fussenegger

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to