Note that there's a useful implication to this. It would allow something
like this

expose finished

finished = .false

someobject~doSomeWork(>finished)

-- do some more stuff


guard on when finished   -- wait for the thread to continue



Where the doSomeWork method could be something like this

::method doSomeWork
  use arg >finished

  reply   -- go multi-threaded

  -- work goes on here


 finished = .true  -- signal completion


This allows coordination between two objects without either knowing
anything about the other. The shared variable reference provides the
synchronization point.

Rick

On Wed, May 2, 2018 at 9:16 AM, Rony G. Flatscher <rony.flatsc...@wu.ac.at>
wrote:

> Experimenting further with variable references. Very nice feature is to
> also become able to refer to attributes with variable references. E.g.:
>
> -- purpose: test whether attributes can be used via variable references as 
> well
>
> o=.test~new("eins", "zwei")         -- German
> say "1,  o:" o                      -- show current settings of attributes
>
> call change o~getOneRef, "un"       -- French
> say "2a, o:" o                      -- show current settings of attributes
>
> call change o~getTwoRef, "deux"     -- French
> say "2b, o:" o                      -- show current settings of attributes
>
> ::routine change        -- use variable reference to change value to point to
>   use arg >ref, value   -- make "ref" an alias variable
>   ref=value
>
> ::class test            -- class that defines two attributes
> ::attribute one         -- attribute
> ::attribute two         -- atribute
>
> ::method init           -- initialize attribute values
>   expose one two
>   use arg one, two
>
> ::method getOneRef   -- return reference to attribute
>   expose one
>   return >one
>
> ::method getTwoRef   -- return reference to attribute
>   expose two
>   return >two
>
> ::method string
>   expose one two
>   return "a" self~class~id"["one","two"]"
>
> The above program yields:
>
> E:\reference\test2>testAttributeAccess.rex
> 1,  o: a TEST[eins,zwei]
> 2a, o: a TEST[un,zwei]
> 2b, o: a TEST[un,deux]
>
> The question: would access via variable references to attributes be safe
> in a multithreaded scenario as well? I.e. what if a variable reference to
> an attribute get used to change the value (replace or interact with) and in
> another thread a guarded method gets executed concurrently, which guards
> the access to its attributes (thereby blocking concurrent access). Would
> the access to the variable reference be blocked until the guarded method
> completes?
>
> ---rony
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to