Project

General

Profile

Actions

Feature #13601

closed

Remove yield_self from Ruby 2.5 (already implemented)

Added by danielpclark (Daniel P. Clark) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:81398]

Description

Issue https://bugs.ruby-lang.org/issues/6721 for adding yield_self is unnecessary as BasicObject#instance_eval will do the exact same thing.

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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0