Bug #1983: Struct doesn't define instance methods for valid method names
http://redmine.ruby-lang.org/issues/show/1983

Author: Jeremy Kemper
Status: Open, Priority: Normal
Category: core, Target version: 1.9.2
ruby -v: ruby 1.9.2dev (2009-08-16) [i386-darwin9.8.0]

>> foo = Struct.new(:foo?, :foo!).new(true, true)
=> #<struct :foo?=true, :foo!=true>
>> foo.foo?
NoMethodError: undefined method `foo?' for #<struct :foo?=true, :foo!=true>
	from (irb):3
	from /usr/local/bin/irb19:12:in `<main>'
>> foo.foo!
NoMethodError: undefined method `foo!' for #<struct :foo?=true, :foo!=true>
	from (irb):4
	from /usr/local/bin/irb19:12:in `<main>'
>> foo[:foo?]
=> true
>> foo[:foo!]
=> true

I think this is because foo?= and foo!= are not valid setter methods.

By why not generate the reader and skip the setter, then?


----------------------------------------
http://redmine.ruby-lang.org