cascade dispatch commands?
Posted: Tue Mar 12, 2019 10:52 pm
Just throwing this out here for brainstorming...
I have a need to cascade dispatch commands. What I've got is of the form
so if there is no "someCommand" in the message path code will be executed. On the other hand, if there is a "someCommand" handler in the message path (probably because of an added front- or backscript) then that code will be executed in place of the original callers default code. This works as designed. I'm happy.
The problem comes about if I want to extend that further, i.e., in a backscript I might have
and I want to give the ability to add more things later:
That doesn't work because it just recurses into itself again. And
also doesn't work for a similar reason, but only once around.
So anyone got ideas on how to cascade dispatch commands, whether or not they're found in the message path? I've got a solution that works in one specific use case, but it's too ugly to put in the margins here.
I have a need to cascade dispatch commands. What I've got is of the form
Code: Select all
dispatch "someCommand" to me with someParameters
if it is not "handled" then
do_default_stuff
-- otherwise the someCommand has done its work
end if
The problem comes about if I want to extend that further, i.e., in a backscript I might have
Code: Select all
on someCommand @pParameters
do_some_work_here_with_pParameters
end someCommand
Code: Select all
on someCommand @pParameters
do_some_work_here_with_pParameters
dispatch "someCommand" to me with pParameters
end someCommand
Code: Select all
on someCommand @pParameters
do_some_work_here_with_pParameters
pass "someCommand" to me with pParameters
end someCommand
So anyone got ideas on how to cascade dispatch commands, whether or not they're found in the message path? I've got a solution that works in one specific use case, but it's too ugly to put in the margins here.