Re: RFC: Alter - Perl extension for Alter Ego Objects
by kyle (Abbot) on Jun 30, 2007 at 16:17 UTC
|
I don't like the name. If you were looking for a module to do this, and you didn't know what it was called, what would you guess its name to be? I suggest Class::AlterEgo or Object::AlterEgo (to go along with Class::Std and Object::InsideOut).
| [reply] |
|
I'm afraid you have a point there (afraid, because last-minute name changes are such a pain). I guess it'll be Object::AlterEgo (not Class::...)
because, well, it's the object rather than the class that has an alter ego.
Anno
| [reply] [d/l] [select] |
|
| [reply] [d/l] |
|
|
| [reply] |
Re: RFC: Alter - Perl extension for Alter Ego Objects
by Joost (Canon) on Jun 30, 2007 at 22:32 UTC
|
I like this module.
One thing I think would be a useful addition is a C API for XS modules wanting to use this construct. Calling perl functions from C is slow and cumbersome, so having some way of directly retrieving the properties from C (possibly even automatically, via a typemap) would be very nice.
| [reply] |
Re: RFC: Alter - Perl extension for Alter Ego Objects
by shmem (Chancellor) on Jul 01, 2007 at 06:28 UTC
|
I'm glad it makes its way to CPAN. It is IMHO the best, cleanest and most flexible implementation of objects in perl, them being inside-out adding another point.
I believe it will give birth to a new way of doing OO in perl, since Alter objects are truely polymorphic by nature. You can tell them to behave like this or that, merely by blessing them into the package which is needed at the time. (Of course, for multiple ego extensions, those packages must be Alter-aware.)
Keep up the great work, Anno!
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
| [reply] |
|
Thank you. One thing. You said about Alter-based objects
You can tell them to behave like this or that, merely by blessing them into the package which is needed at the time.
Re-blessing isn't really involved in accessing alter egos. It's the package the call to ego() is compiled into that determines the class whose ego is seen. That will normaly be the right one when a class compiles its accessors.
Anno
| [reply] [d/l] |
|
| [reply] |
|
Alter - Alter Ego Objects on CPAN
by Anno (Deacon) on Jul 07, 2007 at 20:01 UTC
|
I have put up the Alter module on CPAN, essentially unchanged against the version I introduced a week ago.
This means I have cast into the wind the sage advice about renaming the module to something that better converys its purpose (but inevitably longer). What's to say? Naming decisions are guts decisions (and particularly hard to make) and that's the way my guts are swinging, if you'll pardon the imagery. The modicum of impudence that lies in occupying a top level name for the little thing is taken into account.
Anno
Update: Made mention of Alter a link | [reply] [d/l] |
|
The modicum of impudence that lies in occupying a top level name for the little thing is taken into account.
It's not a little thing, it's at least of medium size. Not in amount of code, but we're speaking perl, aren't we? I mean impact and importance.
I'm glad you stuck to the original name. It's so... "let's not talk about technical stuff (yawn). Let's name them as we would do, having a good settled amount of knowledge of concepts and analogies."
Sorry for me not being able to lay out clearly what that appraisal means... ;-)
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
| [reply] |
|
It's not a little thing...
Oh, in terms of impact and importance I believe Alter ought to revolutionize Perl OOP and make it what it was meant to be but never quite was. How's that for a humble opinion?
But it can only do that as a core module (nobody likes an XS module among the prereqs), and the timing for that is unfortunate with 5.10 on the doorstep and Alter fresh from the drawing board. It'll get lots of time to mature on CPAN or in 5.11, supposing I get it in there. By the time of 5.12 we're all going to use Perl 6 and the point will be moot. :)
I'm glad you stuck to the original name.
Not everyone is, I got at least one downvote for my writeup :) Hell, I'm not entirely sure I am happy with the decision. I didn't exactly flip a coin, but it was close.
Thanks for your support. It's good to know I'm the only one in favor of the Alter technique.
Anno
| [reply] [d/l] [select] |