You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jörn Nettingsmeier <ne...@apache.org> on 2006/10/14 15:22:12 UTC
inner functions and continuations...
hi everyone!
i'm trying to add local functions to a flowscript in order to make it
more maintainable.
the code looks like this:
function executeUsecase() {
var someLocalVar;
function foo() {
...
}
foo();
sendPageAndWait("/some/pipeline");
foo();
}
the second call to "foo" results in an error ("foo is undefined").
so it appears that those functions are not stored with the continuation.
is this expected behaviour?
so i changed the function declaration to
var foo = function() {
...
}
it seems to work - the function is still available after the
continuation. is this the correct approach?
for the record, i'm using cocoon 2.1 (svn HEAD) with sun java 1.5 on
linux/x86_64.
regards,
jörn
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: inner functions and continuations...
Posted by Geert Josten <ge...@daidalos.nl>.
I am not sure, but I somehow recall that the execution thread is not literally saved, but that the variables in the context are saved and restored and that the function is re-executed, but with a special flag that makes it jump to the position where the previous request left off..
So I think saving the function in a (local) variable is sensible.
Kind regards,
Geert
>
Drs. G.P.H. Josten
Consultant
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984
De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
> Van: Jörn Nettingsmeier [mailto:nettings@apache.org]
> Verzonden: zaterdag 14 oktober 2006 15:22
> Aan: users@cocoon.apache.org
> Onderwerp: inner functions and continuations...
>
> hi everyone!
>
>
> i'm trying to add local functions to a flowscript in order to
> make it more maintainable.
>
> the code looks like this:
>
> function executeUsecase() {
>
> var someLocalVar;
>
> function foo() {
> ...
> }
>
> foo();
> sendPageAndWait("/some/pipeline");
> foo();
> }
>
>
> the second call to "foo" results in an error ("foo is undefined").
> so it appears that those functions are not stored with the
> continuation.
> is this expected behaviour?
>
> so i changed the function declaration to
>
> var foo = function() {
> ...
> }
>
> it seems to work - the function is still available after the
> continuation. is this the correct approach?
>
> for the record, i'm using cocoon 2.1 (svn HEAD) with sun java
> 1.5 on linux/x86_64.
>
>
> regards,
>
> jörn
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org