Project

General

Profile

Actions

Feature #3753

closed

value of def-expr

Added by usa (Usaku NAKAMURA) over 10 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Target version:
[ruby-dev:42151]

Description

=begin
RubyKaigi見てて思い出したのですが、def式はSymbolを返すようにしませんか?
そうすると、

class Foo
private def foo()
# ...
end
end

などと書けるようになります。

以下パッチ。
Index: vm.c
===================================================================
--- vm.c (リビジョン 29124)
+++ vm.c (作業コピー)
@@ -1893,7 +1893,7 @@ m_core_define_method(VALUE self, VALUE c
REWIND_CFP({
vm_define_method(GET_THREAD(), cbase, SYM2ID(sym), iseqval, 0, rb_vm_cref());
});

  • return Qnil;
  • return sym; }

static VALUE
@@ -1902,7 +1902,7 @@ m_core_define_singleton_method(VALUE sel
REWIND_CFP({
vm_define_method(GET_THREAD(), cbase, SYM2ID(sym), iseqval, 1, rb_vm_cref());
});

  • return Qnil;
  • return sym; }

static VALUE
=end


Related issues

Related to Ruby master - Feature #6198: public/protected/private with attr_*Rejectedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF