Hola,

Object::Realize::Later and friends in perl5 get the job done, but
have many caveats.

Will there be a mechanism to provide a way to do inplace replacement
of an object's, err, thingyness (class, data), without losing it's
identity?


I would like a way to transpose objects between classes in the same
instance for several reasons beside lazy loading, btw.

I think one of the most beautiful uses is to provide protocol
handlers in a state machine style implementation, mainly for
security by simplicity.

For example, here is the design of a pop3 server (i actually
implemented it in perl5 and it wasn't too bad):

        parse input, regexy, into cmd args format
        call $backend_obj->cmd(@args);

Each command is a method call, and to switch the modes of the
statemachine, $backend_obj would rebless itself into different
classes, with different commands.

The pass command, for example, will transpose the object to the
authenticated state, if the user/password pair matches. If it fails
it returns to the connected state. The user command is a part of the
connected state, and transposes to the accepting password state, a
subclass of the connected state.

Since method dispatch is quite rigorously tested edge cases are
pretty much tested for, and the implementation is very robust, and
has very explicit logic, provided you're willing to eat it.

I'd like to be able to exploit this more cleanly in Perl 6, and also
get easier and safer lazy loading of objects.

-- 
 ()  Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418  perl hacker &
 /\  kung foo master: /me whallops greyface with a fnord: neeyah!!!!!!!

Attachment: pgpAUfL9j4QNN.pgp
Description: PGP signature

Reply via email to