in reply to Re^2: replace object methods at runtime
in thread replace object methods at runtime
Sure ,
Thank you for indulging me. I've seen this kind of facility requested (or described in other languages), but I've never really seen a non-hypothetical use-case for it. And I'm always more interested in real use cases than hypothetical ones.
That said, without fully understanding the architecture you are describing, it sounds like a complex way of coding a simple boolean condition? Essentially:
sub method { my( $self, @args ) = @_; ... if( $self->_pipeExistsAndIsGood ) { ## communicate with pipe } else { ## $self->_forkAndStorePipe(); } }
I can see that 'dynamic method rewriting' is a way to avoid a boolean test, which might provide a small efficiency gain, but trading that for the complexity and 'action at a distance' involved runtime determination of the code behind a method, along with parent & child time forked instances, just seems like a recipe for complex and difficult to trace bugs and failures.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: replace object methods at runtime
by karavelov (Monk) on Jun 25, 2008 at 17:53 UTC |