irb
irb copied to clipboard
irb warning: "can't alias ls from irb_ls." should perhaps not lead to a warning for vanilla ruby code
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.