Issue #3753 has been updated by yhara (Yutaka HARA). Description updated Target version set to next minor ---------------------------------------- Feature #3753: value of def-expr https://bugs.ruby-lang.org/issues/3753#change-31811 Author: usa (Usaku NAKAMURA) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: core Target version: next minor =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
on 2012-10-27 16:58
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.