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

Suppress command return values #934

Merged
merged 1 commit into from
Apr 26, 2024
Merged

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Apr 26, 2024

Since commands can't be chained with methods, their return values are not intended to be used. But if IRB keeps storing command return values as the last value, and print them, users may rely on such implicit behaviour.

So to avoid such confusion, this commit suppresses command's return values. It also updates some commands that currently rely on this implicit behaviour.

Since commands can't be chained with methods, their return values are
not intended to be used. But if IRB keeps storing command return values
as the last value, and print them, users may rely on such implicit
behaviour.

So to avoid such confusion, this commit suppresses command's
return values. It also updates some commands that currently rely on
this implicit behaviour.
@st0012 st0012 self-assigned this Apr 26, 2024
@tompng tompng merged commit fa96bea into master Apr 26, 2024
59 checks passed
@tompng tompng deleted the suppress-command-return-values branch April 26, 2024 17:52
matzbot pushed a commit to ruby/ruby that referenced this pull request Apr 26, 2024
(ruby/irb#934)

Since commands can't be chained with methods, their return values are
not intended to be used. But if IRB keeps storing command return values
as the last value, and print them, users may rely on such implicit
behaviour.

So to avoid such confusion, this commit suppresses command's
return values. It also updates some commands that currently rely on
this implicit behaviour.

ruby/irb@fa96bea76f
st0012 added a commit that referenced this pull request Jun 16, 2024
In #934, we changed command calls to return nil only. This PR improves
the behaviour even further by:

- Not echoing the `nil` returned by command calls
- Not overriding previous return value stored in `_` with the
  `nil` from commands
tompng pushed a commit that referenced this pull request Jun 18, 2024
In #934, we changed command calls to return nil only. This PR improves
the behaviour even further by:

- Not echoing the `nil` returned by command calls
- Not overriding previous return value stored in `_` with the
  `nil` from commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants