I'm curious - how do you see Perl or C++ or Java lacking this behavior? I know that my personal baseclass has the following lines in the new() call:
That way, I can define a method init() in every class that derives from this baseclass (which is just a way of encapsulating getter/setter/mutator generation and enforcing attribute creation) and I seem to have the same behavior you're touting Python for ...?my $init = $self->can('init'); $init && $init->($self, @_);
------
We are the carpenters and bricklayers of the Information Age.
The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
In reply to Re5: Aspect-Oriented Programming: Couple of Short Examples
by dragonchild
in thread Aspect-Oriented Programming: Couple of Short Examples
by chunlou
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |