[ruby-core:88982] [Ruby trunk Feature#15112] Introdudce the new singleton method STDERR.p

From: merch-redmine@...
Date: 2018-09-13 07:29:00 UTC
List: ruby-core #88982
Issue #15112 has been updated by jeremyevans0 (Jeremy Evans).


mrkn (Kenta Murata) wrote:
> I sometimes write `STDERR.puts obj.inspect` to print debug message to standard error.
> I want to write it as `STDERR.p obj`.
> It can be realized by introducing `p` singleton method in `STDERR` object.

I've heard it is preferable to use `$stderr` (the current standard error stream) instead of `STDERR` (the original standard error stream) as `warn` and similar methods use `$stderr`.  As `$stderr` can be reassigned, there is no guarantee that `$stderr.p` would be valid.  I suppose you could have `STDERR.p` write to `$stderr`, but that may be confusing.  It may be more generally useful to add a method to `IO` that did the equivalent of `puts obj.inspect`.

----------------------------------------
Feature #15112: Introdudce the new singleton method STDERR.p
https://bugs.ruby-lang.org/issues/15112#change-74011

* Author: mrkn (Kenta Murata)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
I sometimes write `STDERR.puts obj.inspect` to print debug message to standard error.
I want to write it as `STDERR.p obj`.
It can be realized by introducing `p` singleton method in `STDERR` object.



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

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

In This Thread

Prev Next