[#4595] New block syntax — Daniel Amelang <daniel.amelang@...>

I'm really sorry if this isn't the place to talk about this. I've

25 messages 2005/03/21
[#4606] Re: New block syntax — "David A. Black" <dblack@...> 2005/03/21

Hi --

[#4629] Re: New block syntax — "Sean E. Russell" <ser@...> 2005/03/30

On Monday 21 March 2005 16:17, David A. Black wrote:

[#4648] about REXML::Encoding — speakillof <speakillof@...>

Hi.

15 messages 2005/03/31
[#4659] Re: about REXML::Encoding — "Sean E. Russell" <ser@...> 2005/04/04

On Thursday 31 March 2005 09:44, speakillof wrote:

Re: Allowing "?" in struct members

From: Nathaniel Talbott <ntalbott@...>
Date: 2005-03-17 14:49:14 UTC
List: ruby-core #4579
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

<:((><


In This Thread