Issue #13601 has been updated by danielpclark (Daniel P. Clark).


You both have provided better examples as to the differences.  Also finding out `yield_self` returns an Enumerator was a new one to me.  I guess this feature request can be closed.

----------------------------------------
Feature #13601: Remove yield_self from Ruby 2.5 (already implemented)
https://bugs.ruby-lang.org/issues/13601#change-65113

* Author: danielpclark (Daniel P. Clark)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Issue https://bugs.ruby-lang.org/issues/6721 for adding `yield_self` is unnecessary as `BasicObject#instance_eval` will do the exact same thing.

~~~ruby
class BasicObject
  alias :yield_self :instance_eval
end

2.yield_self { |x| x*x } # => 4
~~~

I've tried all the examples of its given use cases and `BasicObject#instance_eval` will do them all.

In issue #6721 nobu said he didn't like the name `yield_self`.  I'm in agreement about the name.  Since `BasicObject#instance_eval` will already pipe in `self` and return the value of the block `yield_self` is not necessary.



-- 
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>