On Thu, 17 Mar 2005 23:09:56 +0900, Florian Gro? <florgro / gmail.com> wrote:

> Though I wonder if having "foo?" and "foo=" for boolean accessors like
> flags would not be useful.
> 
> For example I'm frequently using things like Contract.check_fulfills and
> .check_fulfills= and I think that
> 
>    if Contract.check_fulfills? then
>      ...
>    end
> 
> just looks nicer than
> 
>    if Contract.check_fulfills
>      ...
>    end
> 
> OTOH I totally dislike .foo?= because the double combinator just looks
> ugly...
> 
> So if this were to be implemented I think attr_accessor :foo? should
> create .foo? and .foo= -- and Struct.new(:foo?) then would also be similar.

While I like this idea, I wonder what should be done with the following:

  class C
    attr_accessor :foo?
    attr_accessor :foo
  end

Throw an error? Kill 'C#foo?' while adding 'C#foo'? I'm not sure what
would make sense.


-- 
Nathaniel

<:((><