![]() |
|
Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Re: •Re: Why get() and set() accessor methods are evilby Juerd (Abbot) |
on Nov 26, 2003 at 22:44 UTC ( #310401=note: print w/replies, xml ) | Need Help?? |
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
|
|