Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SuperNode should become two nodes #805

Closed
enebo opened this issue Apr 10, 2023 · 3 comments
Closed

SuperNode should become two nodes #805

enebo opened this issue Apr 10, 2023 · 3 comments
Labels

Comments

@enebo
Copy link
Collaborator

enebo commented Apr 10, 2023

Semantically super and super() are different semantically. It also feels awkward to check whether there is an opening token to know which one it is. Adding ZSuperNode wil not only not have tokens for parens it will also not have any arguments or a block.

@enebo
Copy link
Collaborator Author

enebo commented Apr 11, 2023

This is needed for #807

@enebo
Copy link
Collaborator Author

enebo commented Apr 11, 2023

ForwardingSuperNode already exists for ZSuper. This is not an issue.

@enebo enebo closed this as completed Apr 11, 2023
@eregon
Copy link
Member

eregon commented Apr 12, 2023

Aside: it'd be pretty cool if YARP could desugar a zsuper into a regular super for execution purposes, i.e. desugar def m(a, b); a *= 2; super; end into def m(a, b); a *= 2; super(a, b); end.
IIRC that's the correct semantics for zsuper.
That would save Ruby implementations to have to do it themselves which is quite messy (IMO).

It'd a bit tricky if some arguments are unnamed, but those could probably still be encoded in some way (e.g. * could be named *, simply).

Not sure if this would be easy to do in YARP though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants