Skip to content

Support multiple @local statements #98

Open
@mkoculak

Description

@mkoculak

Hey.
First of all, just upgraded to 0.5 and the improvements in code clarity thanks to the macro shorthands are awesome!

While translating my code, I tried inserting multiple local variables in a similar manner:

function localtest()
    @tasks for i in 1:100
        @local x = 0
        @local y = 0.
        x += i
        y += i
        println("x; $x, y: $y")
    end
end

which throws an error:

ERROR: LoadError: The @local macro may only be used inside of a @tasks block.

Wrapping both calls in a @local begin ... end block fixes it, but since documentation does not mention it and there are no examples, it might be good to either fix it or include it in the docs.
(though I see e.g. that Trapezoidal Integration example has multiple calls to local that work - is this equivalent to the macro?)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions