On Jul 16, 2004, at 4:35 PM, John Siracusa wrote:
As for this:
$obj-start_date(format = '%B %d %Y at %T')
being nothing more than syntactic sugar for this:
$obj-start_date-strftime('%B %d %Y at %T')
Yes, that's my argument against it. And it's why dates are such a PITA
in Bricolage.
the
I agree that there is an awkward-ness in the way accessors and mutators
work in DateTime.pm, but one thin I'd like to keep note of is that
$dt-set() should be preserved, if not only for performance's sake
because set() can be used to set multiple fields all at once, reducing
the amount of
I'll vote for this one too. In our development team, for all class
design this is our standard. Return the existing value if one isn't
supplied as an argument. Set the value and return self if there is
a supplied argument.
It works so well that we designed a base class that does all of the
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); #
On Jul 16, 2004, at 2:01 PM, Dave Rolsky wrote:
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
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
On 7/16/04 5:38 PM, David Wheeler wrote:
I've been fond of this argument myself, Dave. And I like having
separate mutators. But it's extremely common among Perl modules, and
really no different than the idea of true attributes. Using lvalue
subs, for example, one could:
$d-day; #
On Jul 16, 2004, at 2:52 PM, John Siracusa wrote:
And I cringe at APIs with 50 methods that begin with set_ and 50 more
that
begin with get_. I have to mentally filter out the prefix noise when
trying
to look up methods based on the part that is the most relevant to the
API
(e.g. day) It's
On 7/16/04 5:58 PM, David Wheeler wrote:
On Jul 16, 2004, at 2:52 PM, John Siracusa wrote:
And I cringe at APIs with 50 methods that begin with set_ and 50 more that
begin with get_. I have to mentally filter out the prefix noise when trying
to look up methods based on the part that is the
On Fri, 16 Jul 2004, John Siracusa wrote:
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
On Fri, 16 Jul 2004, John Siracusa wrote:
On 7/16/04 7:18 PM, Dave Rolsky wrote:
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.
Well, you have to balance few
On 7/16/04 9:15 PM, Dave Rolsky wrote:
(Anyway, ymd() isn't a get/set method at all, is it?)
It's a _get_ method. You're retrieving information from the object,
right? It's just not getting a single attribute.
When I questioned the prevalence of accessors that take arguments to affect
what
[forwarded for discussion]
-- Forwarded message --
Date: Thu, 15 Jul 2004 16:07:22 -0400 (EDT)
From: Michael_G_Schwern via RT [EMAIL PROTECTED]
To: undisclosed-recipients: ;
Subject: [cpan #6980] $d-day(1); == $d-set(day = 1);
This message about DateTime was sent to you
On Jul 15, 2004, at 2:40 PM, Dave Rolsky wrote:
$d-day(1) and friends should be the equivalent of $d-set(day = 1)
to make the interface consistent and obvious.
Hrm. I'm inclined to agree, I think. I like having separate accessors
and mutators but DateTime's current model:
$d-day; # accessor
On 7/15/04 5:55 PM, David Wheeler wrote:
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
Or:
# Java-style
$d-get_day; # accessor
15 matches
Mail list logo