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.
In reply to Pithy names for accessor styles? by xdg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |