|
|
| There's more than one way to do things | |
| PerlMonks |
Re: Re: •Re: Why get() and set() accessor methods are evilby Juerd (Abbot) |
| on Nov 26, 2003 at 17:44 UTC ( [id://310401]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
Granted, a.b = 12; is much nicer looking than a.set_b(12); or a.set_b = 12 FYI, in case you didn't know about it already, Attribute::Property makes a->b = 12 work in Perl 5. From its synopsis:
When modifying a value using an accessor method (which we dubbed 'archaic style'), things get ugly: Having these things1 built-in in Perl 6 will make me happy. Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' } 2 But not officially. They're often called 'attributes', but we should discourage that, because 'attributes' are already something else. Attributes are relatively new, though, so we can't blame writers of older documentation.
In Section
Meditations
|
|
||||||||||||||||||||||||