Isolates: Calling functions in an isolate with an argument

General APL language issues
Post Reply
jwied
Posts: 5
Joined: Wed Feb 24, 2010 7:30 am

Isolates: Calling functions in an isolate with an argument

Post by jwied »

I have a question about isolates and how to give an argument (a local variable) to a function, called in an isolate.

Here´s some code, I tried out:

iss←isolate.New¨'' '' '' ⍝ Make 3 isolates
t←iss.⎕DL 1 1 1 ⍝ Do 3 short delays
t←iss.(#.Version) ⍝ Call a niladic function Version
t←iss.(#.foo 99) ⍝ Call a monadic function foo with a

myLocVar←'abc' 'defg' 'hi' ⍝ simple argument for demo
iss.myVar←myLocVar ⍝ simple argument for demo
t←iss.(#.foo myVar) ⍝ works as expected
iss.(⎕ex'myVar')

⍝ Trying to call the monadic function "direct"
⍝ without defining and expunging variables in the isolates:
t←iss.(#.foo) myLocVar ⍝ FUTURE ERROR: 2: SYNTAX ERROR

What is the correct syntax for calling foo with the elements of myLocVar?
User avatar
Morten|Dyalog
Posts: 460
Joined: Tue Sep 09, 2008 3:52 pm

Re: Isolates: Calling functions in an isolate with an argume

Post by Morten|Dyalog »

At the moment, you can only call functions which are in the isolate namespace. If you need to call a function which is in the root of the isolate process workspace, you need to make an indirect call via a function in the space. The easiest way to do this is to define a dfn on the fly, as in:

Code: Select all

iss.{#.foo ⍵} myVar
jwied
Posts: 5
Joined: Wed Feb 24, 2010 7:30 am

Re: Isolates: Calling functions in an isolate with an argume

Post by jwied »

Thank you, Morten.
That solves my problem.
Post Reply