cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <nicola...@apache.org>
Subject Re: FYI: Using Java to define Cocoon Flow
Date Fri, 16 May 2003 18:15:41 GMT


Christopher Oliver wrote, On 16/05/2003 17.11:
...
> 
> 
> Each scripting language would need to support continuations. The problem 
> for most (including Jython) is that they implement function calls with 
> recursive Java calls to an "eval()" function of some kind. It isn't 
> possible to implement continuations with such languages (because there's 
> no way to copy the Java stack).

Oops, you are right, I forgot that Jython directly uses Java underneath. 
:,-(  sob

>> "
>> Usually, a scripting language author extends the BSFEngineImpl class, 
>> which implements BSFEngine, and only requires the scripting language 
>> author to implement the eval() method. However, the following methods 
>> specified by the BSFEngine interface are the most commonly implemented:
>>
>>     * initialize() - used to set up the underlying scripting language
>>     * call() - used to call functions or methods within the scripting
>>     * eval() - used to evaluate a script
>>     * exec() - used to execute a script
>>     * declareBean() - used to create an implicit object
>>     * undeclareBean() - used to remove an implicit object
>> "
>>
>> So when I run exec() on a script, I loose complete control over it, 
>> and it's the script that has to stop itself and handle me the 
>> continuation that I'll have to handle him later:
>>
>>    * resume(cont)
>>
>> Am I getting there?
>>
> Yes,  but it should be
> 
>    *resume(cont, arg)
> 
> You are allowed to pass an argument to a continuation. This argument 
> becomes the return value of the function invocation that created the 
> continuation when the continuation is resumed.

Ok, gotcha. I was assuming that arg was included in the cont object.

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


Mime
View raw message