Add docs for super nodes#3720
Merged
Merged
Conversation
amomchilov
commented
Nov 14, 2025
| ^^^^^ | ||
|
|
||
| A ForwardingSuperNode can still have a block. | ||
| All other arguments are forwarded as normal, except the original block is replaced with the new block. |
Contributor
Author
There was a problem hiding this comment.
This is pretty surprising, worth documenting explicitly.
#!/opt/rubies/3.4.2/bin/ruby
class Parent
def m(arg)
p [arg, yield]
end
end
class Child < Parent
def m(arg)
super { "different block" }
end
end
# prints ["original arg", "different block"]
Child.new.m("original arg") { "original block" }
Collaborator
There was a problem hiding this comment.
Can you move this comment to the comment on the block field itself instead?
Contributor
Author
There was a problem hiding this comment.
I moved the "All other arguments are forwarded as normal" part, which is what I think you were referring to.
I'd like to keep the "can still have a block." part here, so that it:
- Is near where we say "without parentheses or arguments"
- Show the location of the whole node when it has a block
- Has a link to
SuperNode, which readers would probably also be interested in.
I rejigged it a bit, what do you think?
amomchilov
commented
Nov 14, 2025
amomchilov
force-pushed
the
amomchilov/document-super
branch
from
November 14, 2025 16:29
1fc5e8f to
d021d42
Compare
Contributor
Author
|
Test failure looks unrelated: |
kddnewton
requested changes
Nov 17, 2025
| ^^^^^ | ||
|
|
||
| A ForwardingSuperNode can still have a block. | ||
| All other arguments are forwarded as normal, except the original block is replaced with the new block. |
Collaborator
There was a problem hiding this comment.
Can you move this comment to the comment on the block field itself instead?
amomchilov
force-pushed
the
amomchilov/document-super
branch
from
November 18, 2025 14:51
d021d42 to
69abcdb
Compare
kddnewton
approved these changes
Nov 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.