<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/lib/pp.rb, branch v3_0_4</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Bump pp version to 0.2.1</title>
<updated>2021-11-22T01:51:35+00:00</updated>
<author>
<name>Hiroshi SHIBATA</name>
<email>hsbt@ruby-lang.org</email>
</author>
<published>2021-11-11T08:34:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=989540c9ccf89e4e2d837a123858ab420e5c4b6c'/>
<id>989540c9ccf89e4e2d837a123858ab420e5c4b6c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[DOC] Add doc to sharing_detection= [ci skip]</title>
<updated>2020-12-23T02:13:50+00:00</updated>
<author>
<name>Kazuhiro NISHIYAMA</name>
<email>zn@mbf.nifty.com</email>
</author>
<published>2020-12-23T02:13:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=082114da0552484d2695f685d781418fa51c7ef8'/>
<id>082114da0552484d2695f685d781418fa51c7ef8</id>
<content type='text'>
Before:
```
$ ri sharing_detection=
= .sharing_detection=
(from ruby core)
=== Implementation from PP
------------------------------------------------------------------------
  sharing_detection=(b)
------------------------------------------------------------------------
Returns the sharing detection flag as a boolean value. It is false by
default.
```

After:
```
$ ri sharing_detection=
= .sharing_detection=

(from ruby core)
=== Implementation from PP
------------------------------------------------------------------------
  sharing_detection=(b)

------------------------------------------------------------------------

Sets the sharing detection flag to b.
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before:
```
$ ri sharing_detection=
= .sharing_detection=
(from ruby core)
=== Implementation from PP
------------------------------------------------------------------------
  sharing_detection=(b)
------------------------------------------------------------------------
Returns the sharing detection flag as a boolean value. It is false by
default.
```

After:
```
$ ri sharing_detection=
= .sharing_detection=

(from ruby core)
=== Implementation from PP
------------------------------------------------------------------------
  sharing_detection=(b)

------------------------------------------------------------------------

Sets the sharing detection flag to b.
```
</pre>
</div>
</content>
</entry>
<entry>
<title>pp is ractor-ready.</title>
<updated>2020-12-22T14:32:18+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2020-12-22T08:07:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=cae8bbfe6271a15cf212a83a9c3ac3fedcdc7718'/>
<id>cae8bbfe6271a15cf212a83a9c3ac3fedcdc7718</id>
<content type='text'>
`@sharing_detection` is only one obstruction to support pp on
non-main ractors, so make it ractor-local.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`@sharing_detection` is only one obstruction to support pp on
non-main ractors, so make it ractor-local.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix pp when passed a empty ruby2_keywords-flagged hash as array element</title>
<updated>2020-01-22T18:27:02+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2020-01-22T00:14:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=28d31ead34baff1c4abc0d7d902ef4bc1d576fb2'/>
<id>28d31ead34baff1c4abc0d7d902ef4bc1d576fb2</id>
<content type='text'>
This causes problems because the hash is passed to a block not
accepting keywords.  Because the hash is empty and keyword flagged,
it is removed before calling the block.  This doesn't cause an
ArgumentError because it is a block and not a lambda.  Just like
any other block not passed required arguments, arguments not
passed are set to nil.

Issues like this are a strong reason not to have ruby2_keywords
by default.

Fixes [Bug #16519]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This causes problems because the hash is passed to a block not
accepting keywords.  Because the hash is empty and keyword flagged,
it is removed before calling the block.  This doesn't cause an
ArgumentError because it is a block and not a lambda.  Just like
any other block not passed required arguments, arguments not
passed are set to nil.

Issues like this are a strong reason not to have ruby2_keywords
by default.

Fixes [Bug #16519]
</pre>
</div>
</content>
</entry>
<entry>
<title>Make prettyprint’s cycle detection aware of Delegator instances</title>
<updated>2019-12-16T14:43:49+00:00</updated>
<author>
<name>Richard Viney</name>
<email>richard.viney@gmail.com</email>
</author>
<published>2017-01-22T01:50:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6a75a460536a32fb62184dc5d8d66ddd737a9bad'/>
<id>6a75a460536a32fb62184dc5d8d66ddd737a9bad</id>
<content type='text'>
Fixes [Bug #13144]

Co-Authored-By: Nobuyoshi Nakada &lt;nobu@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes [Bug #13144]

Co-Authored-By: Nobuyoshi Nakada &lt;nobu@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Deprecate taint/trust and related methods, and make the methods no-ops</title>
<updated>2019-11-17T23:00:25+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2019-09-25T03:59:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ffd0820ab317542f8780aac475da590a4bdbc7a8'/>
<id>ffd0820ab317542f8780aac475da590a4bdbc7a8</id>
<content type='text'>
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
</pre>
</div>
</content>
</entry>
<entry>
<title>Use ident hash for top-level recursion check</title>
<updated>2019-11-04T23:27:15+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2019-11-04T04:51:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ebbe396d3c89345a1c36c0b5154e314cc33e19b7'/>
<id>ebbe396d3c89345a1c36c0b5154e314cc33e19b7</id>
<content type='text'>
We track recursion in order to not infinite loop in ==, inspect, and
similar methods by keeping a thread-local 1 or 2 level hash. This allows
us to track when we have seen the same object (ex. using inspect) or
same pair of objects (ex. using ==) in this stack before and to treat
that differently.

Previously both levels of this Hash used the object's memory_id as a key
(using object_id would be slow and wasteful). Unfortunately, prettyprint
(pp.rb) uses this thread local variable to "pretend" to be inspect and
inherit its same recursion behaviour.

This commit changes the top-level hash to be an identity hash and to use
objects as keys instead of their object_ids.

I'd like to have also converted the 2nd level hash to an ident hash, but
it would have prevented an optimization which avoids allocating a 2nd
level hash for only a single element, which we want to keep because it's
by far the most common case.

So the new format of this hash is:

{ object =&gt; true } (not paired)
{ lhs_object =&gt; rhs_object_memory_id } (paired, single object)
{ lhs_object =&gt; { rhs_object_memory_id =&gt; true, ... } } (paired, many objects)

We must also update pp.rb to match this (using identity hashes).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We track recursion in order to not infinite loop in ==, inspect, and
similar methods by keeping a thread-local 1 or 2 level hash. This allows
us to track when we have seen the same object (ex. using inspect) or
same pair of objects (ex. using ==) in this stack before and to treat
that differently.

Previously both levels of this Hash used the object's memory_id as a key
(using object_id would be slow and wasteful). Unfortunately, prettyprint
(pp.rb) uses this thread local variable to "pretend" to be inspect and
inherit its same recursion behaviour.

This commit changes the top-level hash to be an identity hash and to use
objects as keys instead of their object_ids.

I'd like to have also converted the 2nd level hash to an ident hash, but
it would have prevented an optimization which avoids allocating a 2nd
level hash for only a single element, which we want to keep because it's
by far the most common case.

So the new format of this hash is:

{ object =&gt; true } (not paired)
{ lhs_object =&gt; rhs_object_memory_id } (paired, single object)
{ lhs_object =&gt; { rhs_object_memory_id =&gt; true, ... } } (paired, many objects)

We must also update pp.rb to match this (using identity hashes).
</pre>
</div>
</content>
</entry>
<entry>
<title>lib/pp.rb: Use UnboundMethod#bind_call instead of .bind(obj).call(...)</title>
<updated>2019-08-30T02:13:00+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2019-08-30T02:11:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c9fc82983ccf624ccec88ffafe6f4e3eb8e7abc4'/>
<id>c9fc82983ccf624ccec88ffafe6f4e3eb8e7abc4</id>
<content type='text'>
Related to [Feature #15955].
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Related to [Feature #15955].
</pre>
</div>
</content>
</entry>
<entry>
<title>Introduce pattern matching [EXPERIMENTAL]</title>
<updated>2019-04-17T06:48:03+00:00</updated>
<author>
<name>ktsj</name>
<email>ktsj@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2019-04-17T06:48:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9738f96fcfe50b2a605e350bdd40bd7a85665f54'/>
<id>9738f96fcfe50b2a605e350bdd40bd7a85665f54</id>
<content type='text'>
[ruby-core:87945] [Feature #14912]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ruby-core:87945] [Feature #14912]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>lib/pp.rb (Range#pretty_print): support endless range</title>
<updated>2018-12-03T01:39:45+00:00</updated>
<author>
<name>mame</name>
<email>mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2018-12-03T01:39:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2c840bbfef2d6a06282f3698548f95ef85819ca7'/>
<id>2c840bbfef2d6a06282f3698548f95ef85819ca7</id>
<content type='text'>
`pp(1..)` should print `"(1..)"` instead of `"(1..nil)"`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`pp(1..)` should print `"(1..)"` instead of `"(1..nil)"`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
</feed>
