Hi all,

To clarify, I wasn't proposing that the 'Flow Action' would reuse existing flow code, nor that it would be compatible with continuations; this would be a new facility for new code, and only used in a functional context, and with map:act, not with map:call (which is already too overloaded anyway).

I'm not aware of any other restrictions, however when I get two seconds to test my proposed modifications, I'll let you know ;)

For the record I am proposing:

<map:act type="flow">
   <map:parameter name="function" value="foo"/>
  <map:parameter name="operand-a" value="{request-param:a}"/>
  <map:parameter name="operand-b" value="{request-param:a}"/>

   <map:generate src="bar/{result-a}/{result-b}"/>
   <map:transform ...>
</map:act>

where foo() is:

function foo() {
        var a = cocoon.parameters['operand-a'];
        ...

        return {'result-a': 1, 'result-b': 'abc'};
}

Note that map:act has a @src attribute I haven't seen used much; I wasn't proposing to add a @function, since this would require changing the Action interface (arghh!), but I might (as well) use @src to pass the function name.

Ellis.



On 8 Jul 2007, at 03:26, Vadim Gritsenko wrote:

Daniel Fagerstrom wrote:
Vadim Gritsenko skrev:
Daniel Fagerstrom wrote:
I would much prefer to just use the return value of the flowscript:

myFlowAction() {
  return calculateSomething();
}

I don't think this will work with FOM_Cocoon.suicide()
That was a cryptic message ;) I need some more details to see what is the problem.

Sorry :)

To give some context: we are not discussing any changes in how you use flowscripts. What we discuss is adding an action that reuses the flow infrastructure. This is for making it easier to write stateless webapps.
...
Does the problem you see still apply in the "flow action" scenario?

Yes; here is minimal example of the situation [1]:

  <map:act function="foo">
    <map:generate src="{one}"/>
    <map:transform src="{two}"/>
    <map:serialize/>
  </map:act>

  function foo() {
    bar();
  }

  function bar() {
    baz();
  }

  function baz() {
    // This will work:
    cocoon.result = { one: "one.xml", two: "two.xslt" };
    FOM_Cocoon.suicide();

    // This does not, without refactoring all of the methods above :)
    return { one: "one.xml", two: "two.xslt" };
  }

If you have non trivial amount of javascript already written, it won't be possible to use new flowscript actions stuff if they do not work with suicide() method.

[1] Here I suggest using different syntax for flowscript actions, not regular map:call, to remove any possible confusion, and we can preserve existing behavior of map:call.

Vadim

Reply via email to