Skip to content

Conversation

nikic
Copy link
Member

@nikic nikic commented Mar 14, 2019

This is based on top of #3941 and implements a short closure variant that uses ($x) ==> $x * $y syntax. As mentioned in the RFC, this requires lexer scanahead, which is implemented here in proof of concept form. The actual implementation would want to also store the scanahead tokens so they can be replayed rather than relexed.

I tried getting the same to work for the ($x) => $x * $y syntax, but couldn't figure out how to do this. The problem is that some ( will be incorrectly classified as T_ARROW_START, and we need additional productions to ensure that T_ARROW_START expr ')' T_DOUBLE_ARROW is not interpreted as an arrow function inside arrays and yields. I haven't figured out how to avoid the resulting conflicts.

@nikic
Copy link
Member Author

nikic commented Apr 21, 2019

Closing this, as I went with #3941 in the end.

@nikic nikic closed this Apr 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants