Issue #14123 has been updated by mame (Yusuke Endoh).


Brief background: I talked about `pp` with some people at RubyConf, and all people are tired of writing `require "pp"`.  And then, we reached this simple solution.  Note that we already have a similar trick, as [`Binding#irb`](https://github.com/ruby/ruby/blob/bca966617e4d765c3cfb8cecf1030f1e3c2fb2db/prelude.rb#L138-L143), though I'm unsure if [it is officially accepted or not](https://bugs.ruby-lang.org/issues/13099).

----------------------------------------
Feature #14123: Kernel#pp by default
https://bugs.ruby-lang.org/issues/14123#change-67880

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 2.5
----------------------------------------
Matz, may I commit this?  I really want this.

```
diff --git a/prelude.rb b/prelude.rb
index 7b98e28285..87f49ac9fb 100644
--- a/prelude.rb
+++ b/prelude.rb
@@ -141,3 +141,11 @@ def irb
     irb
   end
 end
+
+module Kernel
+  def pp(*objs)
+    undef :pp
+    require 'pp'
+    pp(*objs)
+  end
+end
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>