2 ms·
Sure. And just for attributes, there's also delegation, read-only attributes, builders, lazy init, roles, modifiers which are enforced at construction time (if
by csirac2 12y ago
Sure. And just for attributes, there's also delegation, read-only attributes, builders, lazy init, roles, modifiers which are enforced at construction time (if `required` is true).
Moose isn't hard to implement, it's actually had quite a few alternate implementations even in Perl. Python has enthought's traits package, and I've just been pointed to https://github.com/frasertweedale/elk https://github.com/frasertweedale/elk as well.
BTW it sucks to nit-pick, but the Moose version isn't any more verbose than yours:
package Foo;
use Moose;
has 'bar' => ( isa => 'Integer' );