Project

General

Profile

Actions

Bug #10283

closed

Calling define_method with a dynamic symbol ending in = results in a NoMethodError when calling the method via assignment, until called via send

Added by jeremyevans0 (Jeremy Evans) over 9 years ago. Updated over 9 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 2.2.0preview1 (2014-09-17 trunk 47616) [i386-openbsd]
[ruby-core:65218]

Description

This raises a NoMethodError in ruby 2.2.0preview1:

ruby -e "class A; define_method('b='.to_sym){|v|}; end; A.new.b = 1"

This does not, showing it is specific to dynamic symbols:

ruby -e "class A; define_method(:b=){|v|}; end; A.new.b = 1"

This does not, showing it is specific to symbols ending in =:

ruby -e "class A; define_method('b'.to_sym){}; end; A.new.b"

This does not, showing it works when called via send:

ruby -e "class A; define_method('b='.to_sym){|v|}; end; A.new.send(:b=, 1)"

This does not, showing it works after calling send:

ruby -e "class A; define_method('b='.to_sym){|v|}; end; A.new.send(:b=, 1); A.new.b = 1"

I apologize if this is already fixed in trunk.


Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #10259: send を使った attr_writer への書き込みができない場合があるClosed09/18/2014Actions
Has duplicate Ruby master - Bug #10299: alias_method :new_foo=, :"#{:foo}=" doesn't work properly on ruby 2.2.0preview1.Closed09/27/2014Actions

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Related to Bug #10266: String#to_sym generates too big object_id? added

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Related to deleted (Bug #10266: String#to_sym generates too big object_id?)

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Related to Bug #10259: send を使った attr_writer への書き込みができない場合がある added

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Description updated (diff)
  • Status changed from Open to Closed
  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Has duplicate Bug #10299: alias_method :new_foo=, :"#{:foo}=" doesn't work properly on ruby 2.2.0preview1. added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0