Hi Rony

2011/6/5 Rony G. Flatscher <rony.flatsc...@wu-wien.ac.at>

> would it be possible to have the REPLY keyword statement for routines?
>
> If I remove the test context->inMethod() then reply *seems* to work from a
::routine (tested with a tiny script).
But this is not a proof that it would work all the times.
It crashes when called from an internal routine.


> There are quite a few cases, where using routines and multithreading
> would seem to be easier to comprehend and to apply, if REPLY was
> available for routines.
>
> A good old class method is almost as simple as a ::routine. I don't see any
gain of functionality if we allow to reply from a ::routine, unless we allow
also to expose some variables from a ::routine.

[digression]

Instructions that can be called only from methods :

expose : I still don't understand why it's not possible to expose variables
from a ::routine...
If we do a relation with
- anonymous inline functions (often called lambda or block),
- outer environment (the variables used by the lambda, which are not
parameters),
- and closure (which is the outer environment which remains associated to
the lambda, even when the lambda is called outside the definer's scope),
then the exposed variables would be the variables to retain in the closure.
Most of the languages don't require to declare the variables to capture, but
C++ lets *optionally* declare them, and that remind me the functionality of
our expose :
----- c++
std::vector<int> some_list;
int total = 0;
std::for_each(some_list.begin(), some_list.end(), [&total](int x) { total +=
x; });
----- oorexx (with extensions)
some_list = .array~of..
total = 0
some_list~each([expose total; total += arg(1)])
-----
C++ lets capture a variable by value or by reference. In ooRexx, expose is
always by reference, right ? Currently, only internal procedures allow to
expose variables, but internal procedures can't be manipulated like
routines...
In the example above, there is a need of closure, because the lambda is
called in the context of the 'each' method, which is not the context of the
definer (i.e. 'each' does not - and could not - expose the 'total'
variable).


forward : nothing to say


guard : in relation with the object variables dictionary (ovd). I don't know
if the routines have a similar concept like caller variables dictionary (cvd
?). And I don't know if that would make sense to manage synchronisation on
this cvd. Probably yes, synchronisation would be necessary if we allow
- reply and expose in ::routine
- expose and closure (even if no reply in ::routine, because thanks to the
closure, a routine can be passed as argument to methods which reply, and
then call the routine which will access to the exposed variable of the
closure).

reply : already discussed

Jean-Louis
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to