Feature #8779

Binding#yourself

Added by Genki Takiuchi almost 2 years ago. Updated 11 months ago.

[ruby-dev:47613]
Status:Closed
Priority:Normal
Assignee:Nobuyoshi Nakada

Description

Blockの内部のコンテクストにアクセスするために Binding#eval が利用する機会がありますが、
eval を多用するのは効率が悪いので、Binding#eval('self') を返すことに特化した
Binding#yourself の実装を提案いたします。
yourself にアクセスできれば、素の eval を呼ぶ必要がほとんどなくなるので効率化が期待できます。

ちなみに yourself の名付け親は @ko1 さんです :)

(See https://twitter.com/_ko1/status/366768368621076480)

Associated revisions

Revision 46646
Added by Nobuyoshi Nakada 11 months ago

proc.c: Binding#receiver

  • proc.c (bind_receiver): new method to return the bound receiver of the binding object. [Feature #8779]

Revision 46646
Added by Nobuyoshi Nakada 11 months ago

proc.c: Binding#receiver

  • proc.c (bind_receiver): new method to return the bound receiver of the binding object. [Feature #8779]

History

#1 Updated by Genki Takiuchi over 1 year ago

Ruby開発社会議20130831での議論の結果、

Binding#receiver

ということに。

#2 Updated by Koichi Sasada 11 months ago

  • Category set to core
  • Assignee set to Nobuyoshi Nakada
  • Target version set to current: 2.2.0

なんと、accept されていた。
2.2 で入れる?
(self.self 書いてみるとキモカワイかったのだけど -> http://www.atdot.net/~ko1/diary/201407.html#d2

#3 Updated by Nobuyoshi Nakada 11 months ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r46646.


proc.c: Binding#receiver

  • proc.c (bind_receiver): new method to return the bound receiver of the binding object. [Feature #8779]

Also available in: Atom PDF