Callback in WFM
Implementation issues for callbacks
Purpose
Get access to WFM and SCR functionality in UI code.
Read and write WFM scope variables.
Call WFM defined functions.
Use SCR agents.
Restrictions
Ensure proper return of original UI() call.
Check for (or block ?) reentrancy.
Don't use WFM if it can be done in UI().
Keep overhead (e.g. serial connection) in mind.
Implementation options
- return YCPCallback() value
will be tricky since we must re-enter UI after evaluating the
callback. Where and how do we re-enter at the correct point in code ?
mayba a __callback and __continue builtin could be used.
- intercept component->evaluate()
This is basically the same.
- open separate communication channel
might be cleanest solution but breaks horribly with the current
stdin/stdout concept.
- _callback() builtin
similar to YCPCallback() value (with similar problems ...)
we need a 'backlink' in the component concept to pass values
back and forth between components. It is a virtual communication
channel.
Practically, this complete solution isn't needed since SCR does not
have an interpreter of it's own. So it is incapabable of issuing a callback.
This is only needed between UI (server) and WFM (client).
So only y2component::evaluate() is affected, not y2component::doActualWork() !!
- callback() slot in Y2Component
This is the only viable solution as it allows a transparent callback across
the component interface.
Syntactical issues
First approach WFM(wfm-code) is bad because it will
lead to WFM(SCR(...)). Having WFM() is a good idea, but we
also need SCR() to make it transparent.