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

irb warning: "can't alias ls from irb_ls." should perhaps not lead to a warning for vanilla ruby code #341

Closed
rubyFeedback opened this issue Jan 30, 2022 · 1 comment

Comments

@rubyFeedback
Copy link

Take the following content of irbrc:


def ll                   
  pp Dir.pwd             
end                      
                     
alias ls ll

irb shows this warning:

irb: warn: can't alias ls from irb_ls.

I am not sure whether that warning should show. I understand that
aycabta wanted to make irb nicer to use, and he succeeded - no
doubt. The modern irb is much better than the oldschool irb, tons
more features and so forth.

But I believe we ruby users should be able to do something
such as "alias ls any_method_name". IRB should ideally
simulate vanilla ruby as much as possible, so that warning is
a bit strange. I would suggest to not show the warning.

It is not a big issue since it is just a warning, but I just ran into
this problem. In my project (gem called roebe) I carry my own
irbrc, where I tap into all my other ruby code. One method
call is "ll", which is a wrapper over a class that displays the
content of a directory in a colourized manner. Because I am
forgetful and I hate having to remember something, I use
tons of aliases, and "ls" is one such alias that i use.

I hope my use case description is useful. I am not necessarily
suggesting any change have to be made! It is ok to close this
issue either way. But I wanted to let aycabta know that there
are real use cases. Perhaps if you want to change it for a
later time, we could have different "profiles" or something,
such as:

"vanilla irb" tries to be as much ruby as possible
"feature-rich irb" can have the current behaviour, and so
forth. But anyway, I report this just to let aycabta and the
ruby core team know - you guys can proceed how you want
to, and please do feel free to close this issue at any moment
in time as well. Thank you for reading.

@tompng
Copy link
Member

tompng commented Aug 13, 2024

Fixed in irb 1.13.0 #824

@tompng tompng closed this as completed Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants