xdg has asked for the wisdom of the Perl Monks concerning the following question:
I'm looking for some pithy ways of describing different accessor styles. I'm planning to use this with some accessor generating code, e.g. { style => 'perl'}. I've seen a variety of terms used here and elsewhere and am looking for something that is both brief and clear. Potential examples:
Combination accessors that either get or set. Potential style names: "classic", "combo", "perl", "bimodal".
$obj->name( "Buttercup" ); print $obj->name();Separate getters and setters. Potential style names: "get_set", "affordance" (I cringe, but Class::Meta uses it).
$obj->set_name( "Humperdink" ); print $obj->get_name();Non-symmetric getters and setters. Potential style names: "eiffel", "semi-affordance".
$obj->set_name( "Inigo" ); print $obj->name();Lvalues (actually this is easy). Potential style names: "lvalue".
$obj->name = "Dread Pirate Roberts"; print $obj->name;What names do you think work best for these styles? Are there other styles you personally prefer and what would you call it, e.g. "Java" style: getName and setName?
Update: Lots of (++) received, but few suggestions! Please post comments -- a couple lines on which of the style names above you favor is fine.
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pithy names for accessor styles?
by merlyn (Sage) on Jan 19, 2006 at 22:54 UTC | |
by xdg (Monsignor) on Jan 20, 2006 at 00:08 UTC | |
by Anonymous Monk on Jan 19, 2006 at 23:09 UTC | |
|
Re: Pithy names for accessor styles?
by duckyd (Hermit) on Jan 20, 2006 at 01:54 UTC | |
|
Re: Pithy names for accessor styles?
by Anonymous Monk on Jan 20, 2006 at 01:09 UTC | |
|
Re: Pithy names for accessor styles?
by Aristotle (Chancellor) on Jan 20, 2006 at 22:14 UTC | |
|
Re: Pithy names for accessor styles?
by Anonymous Monk on Jan 20, 2006 at 22:37 UTC |