Skip to content

spawn should capture global variables #91

@JeffBezanson

Description

@JeffBezanson

@spawn expressions correctly capture local variables the way closures always do, but this does not work for global variables defined at the prompt:

julia> d=drandn(4,4)
DArray((4,4),RemoteRef(1,1,2),[1,2],[1,3,5],2,1,GlobalObject())

julia> @spawn d[1]+1
RemoteRef(2,1,4)

julia> exception on 2: in anonymous: d not defined

This should be made to work somehow. Basically we need to surround the spawn with let d=d ... for each global it references.

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions