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
  $d->set_day(1); # mutator

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

Or:

  # Java-style
  $d->get_day; # accessor
  $d->set_day(1); # mutator

Thoughts?

David



Reply via email to