On 7/16/04 5:01 PM, Dave Rolsky wrote: > On Thu, 15 Jul 2004, David Wheeler wrote: >> Has a different naming convention for the two types of methods. I kind >> of like it, but only in environments where attributes are virtually >> always READ, and rarely WRITTEN. So maybe it should be: >> >> # Perl-style >> $d->day; # accessor >> $d->day(1); # mutator > > Let me cut off this line of discussion, because I really, really, really > hate this style of dual-purpose methods. The reason I dislike it so much > is that it's impossible to distinguish between a mutator and an accessor > that accepts arguments to affect what it returns.
It's not "impossible", since you can always make up some rule to distinguish the two (e.g. a single argument means set, name/value pairs mean define what to return). Anyway, what percentage of accessors take "arguments to affect what they return"? If you want to return different kinds of things, you should make different accessors, IMO. -John
