From: Yusuke Endoh Date: 2010-03-02T22:42:07+09:00 Subject: [ruby-core:28419] [Bug #1983](Rejected) Struct doesn't define instance methods for valid method names Issue #1983 has been updated by Yusuke Endoh. Status changed from Open to Rejected Hi Jeremy, > By why not generate the reader and skip the setter, then? In [ruby-core:4404], matz decided to prohibit such a field name once. And in [ruby-core:4577], he relaxed the restriction: > having field names with "?" can be valid if field > accessor is disabled for such cases. So it is currently intended, not a bug. I close this ticket. You can re-register this as Feature ticket. If you do, please elaborate the motivation example. > I'd like attr_reader :foo? to work too. It's a common convention for booleans. We cannot define @foo? even by using reflection: instance_variable_set(:"@foo?", 42) #=> `@foo?' is not allowed as an instance variable name (NameError) It is never a common convention. IMO, if such a field name is allowed, we would next want to use foo?= and @foo?. I think Ruby design is sane because it limits ourselves from such earthly desires. -- Yusuke Endoh ---------------------------------------- http://redmine.ruby-lang.org/issues/show/1983 ---------------------------------------- http://redmine.ruby-lang.org