[#1263] Draft of the updated Ruby FAQ — Dave Thomas <Dave@...>

33 messages 2000/02/08

[#1376] Re: Scripting versus programming — Andrew Hunt <andy@...>

Conrad writes:

13 messages 2000/02/15

[#1508] Ruby/GTK and the mainloop — Ian Main <imain@...>

17 messages 2000/02/19
[#1544] Re: Ruby/GTK and the mainloop — Yasushi Shoji <yashi@...> 2000/02/23

Hello Ian,

[#1550] Re: Ruby/GTK and the mainloop — Ian Main <imain@...> 2000/02/23

On Wed, Feb 23, 2000 at 02:56:10AM -0500, Yasushi Shoji wrote:

[#1516] Ruby: PLEASE use comp.lang.misc for all Ruby programming/technical questions/discussions!!!! — "Conrad Schneiker" <schneiker@...>

((FYI: This was sent to the Ruby mail list.))

10 messages 2000/02/19

[#1569] Re: Ruby: constructors, new and initialise — Yukihiro Matsumoto <matz@...>

The following message is a courtesy copy of an article

12 messages 2000/02/25

[ruby-talk:01612] Re: mutator methods

From: Dave Thomas <Dave@...>
Date: 2000-02-28 03:15:51 UTC
List: ruby-talk #1612
The following message is a courtesy copy of an article
that has been posted to comp.lang.misc as well.

"Conrad Schneiker" <schneiker@jump.net> writes:

> From: Dave Thomas <Dave@thomases.com>
> 
> > "Conrad Schneiker" <schneiker@jump.net> writes:
> >
> > > Is there any reason that all mutator methods should not be denoted by
> having
> > > a '!'?
> >
> >   arr[1]=! 1
> >
> > is a little ugly!
> 
> Good point.
> 
> But what I actually had in mind was names of mutator methods with predefined
> English names or (more or less) alphanumeric user-defined names.

I know - I was being a little silly.

The real problem I see with the change is that it may lead to
confusion over existing methods.

Right now, if there's a 'chop' and a 'chop!', you know that the chop!
variant is a mutator. However, if we rename all mutators to end in !,
then for a while we'll have (say) Array.filter and
Array.filter!. Based on the chop example, people might reasonably
expect 'filter' to return a copy, and 'filter!' to be a
mutator. They'd be surprised the first time 'filter' altered an array
they thought was safe.

I think if the convention had been adopted from the start, it would
have been good. I think for new classes, it's a good convention to
adopt. For the existing stuff, I'm not so sure the change doesn't
bring more confusion than it saves.

But... I'm happy to be convinced the other way.


Regards


Dave

In This Thread

Prev Next