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?
Isolates: Calling functions in an isolate with an argument
- Morten|Dyalog
- Posts: 460
- Joined: Tue Sep 09, 2008 3:52 pm
Re: Isolates: Calling functions in an isolate with an argume
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
Re: Isolates: Calling functions in an isolate with an argume
Thank you, Morten.
That solves my problem.
That solves my problem.