Project

General

Profile

Misc #16444

What is the reason for the warning of IRB?

Added by y-yagi (Yuji Yaginuma) 8 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
[ruby-core:96400]

Description

Ruby 2.7 always shows a warning when starting IRB. Why is this necessary?

Of course, ways to suppress the warning have been suggested.
However, libraries that extend IRB, such as rails console and aruba, may not receive arguments equivalent as IRB.
In this case, trying to run as suggested in this proposal(e.g. run rails console with --legacy argument) will result in an error. I think this can be confusing for users.

If have not major known issues, I think we can keep the current behavior without warning. On the other hand, if there is already an issue, isn't the better for the old behavior by default?

Thanks.

Updated by shevegen (Robert A. Heiler) 8 months ago

Agreed for compatibility - may be better to retain the old behaviour as-is.

I believe it was not a deliberate change but an oversight since the author
of reline here on the issue tracker also mentioned compatibility being
an important goal for the rewrite, about a year ago; matz also mentioned
this.

Hopefully that may be fixed before xmas. :)

#2

Updated by y-yagi (Yuji Yaginuma) 8 months ago

  • Description updated (diff)

Updated by mame (Yusuke Endoh) 8 months ago

I believe that it is too late to discuss "opt-in or opt-out?".

IMO, the quality of the new IRB is not so low. But it highly depends upon environments (OS, terminal, how to use, etc.), so we want people to use the new version, give feedback, and help us improve quality. That being said, if people hit an issue, they need to work around it. So the banner message is added.

I understand that the message is not fit to rails console. But "change the default!" and "remove the message!" are too aggressive, I think. Please consider why it is added, and please propose more moderate options like rephasing the message, providing another way to configure it, etc.

Updated by y-yagi (Yuji Yaginuma) 8 months ago

Thanks for your feedback. OK. I understood that too late to discuss and a message is as expected.

I think it would be good if the message could be configurable, but I will also consider expanding the options on the library side. Thanks.

Updated by mame (Yusuke Endoh) 8 months ago

I guess we may provide an API to hide or alter the message for rails console and other tools. Pull request is welcome to ruby/irb.

Updated by nobu (Nobuyoshi Nakada) 8 months ago

A patch to suppress the warning when started as console.

diff --git a/lib/irb/init.rb b/lib/irb/init.rb
index 2af872fd03..464b33ae03 100644
--- a/lib/irb/init.rb
+++ b/lib/irb/init.rb
@@ -31,6 +31,8 @@
     @TRACER_INITIALIZED = false

     # default configurations
+    @CONF[:USE_MULTILINE] = true if ap_path
+
     unless ap_path and @CONF[:AP_NAME]
       ap_path = File.join(File.dirname(File.dirname(__FILE__)), "irb.rb")
     end

Updated by mame (Yusuke Endoh) 8 months ago

  • Status changed from Open to Closed

Also available in: Atom PDF