-
Notifications
You must be signed in to change notification settings - Fork 121
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
Remove unused InputMethod#initialize
#635
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a search on GitHub,
InputMethod.new
was found to be used in two repositories.I believe it would be better to show a deprecation warning before removal.
https://github.com/search?q=%22+InputMethod.new%22+language%3ARuby&type=code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's thoughtful to think about external dependants when dropping things 👍 But in this case I think we should not be blocked by them because:
irb_remote
hasn't received any update for 5 years and it already passes incorrect number of arguments toInputMethod.new
. So it's already broken.irb-power_assert
, it's used to build an IRB environment for testing incorrectly. I say incorrectly becauseInputMethod
is an abstract class. So in practice it should have not been initialised directly. If the author switch toStdioInputMethod
instead, that may be better and more stable.But the root problem is that we and previous maintainers don't define what's official APIs, what's not, and ways/principles to achieve what they need without using private APIs.
My current categorisation is:
binding.irb
andIRB.start
IRB::ExtendCommandBundle
IRB::Irb
So IMO
InputMethod
, or even its child classes likeRelineInputMethod
...etc., should be considered private. Otherwise, our work on refactoring IRB would be seriously affected.What are your thoughts? @tompng @hasumikin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation. I understand, and it does not seem to be a problem to delete InputMethod.new.
However, I think we should carefully migrate the other InputMethods since they are widely used.
Not all of the code is IRB-related, but there seems to be a lot there. (Not sure if they have been active recently)
https://github.com/search?q=InputMethod.new+language%3ARuby+&type=code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the refactor looks good. InputMethod should not have FileInputMethod specific attribute.
My opinion for public and private are:
Sub classes: IMO should be private forever. There are alternatives.
InputMethod: Maybe we can make it public in the future. But now, there is no way to set output method. It's hard to implement something like remote IRB using socket because users can only change input. So the use case of custom input method is very limited.
IRB::Irb#initialize
had ouput_method but it was unused/unimplemented and removed in 53f7769There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your consideration, I was facing CI failures with these changes, but this discussion helps me a lot.
I just replaced
s/InputMethod/IRB::StdioInputMethod/
for now.Feel free to leave care about irb-power-assert anymore, I will catch up IRB changes in #673 if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kachick Thank you for the feedback and sorry for breaking your project's CI.
After taking a closer look, I think the test setup actually doesn't need to specify an input method at all. So I opened kachick/irb-power_assert#114 and I hope it will simplify its maintenance in the long run 🙂