in reply to Re: Good practice for OO module defaults
in thread Good practice for OO module defaults
"It's recommended to always make an Moo attribute lazy unless there's a good reason for it not to be."
Recommended by whom? Plenty of attributes simply don't have any sensible default value. For many attributes, having them unset is itself meaningful. (For example, if you object has an output_file attribute, leaving it unset might indicate that you don't want it to produce any output.) And if the default is a simple value (like 0, 1, undef, or the empty string) then making it eager (i.e. not lazy) may have performance benefits.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Good practice for OO module defaults
by 1nickt (Canon) on Apr 10, 2019 at 10:53 UTC | |
by tobyink (Canon) on Apr 10, 2019 at 14:02 UTC |
In Section
Seekers of Perl Wisdom