JuliaDynamics/Agents.jl

Using the @agent macro causes an error

AtticusBeachy opened this issue · 1 comments

Describe the bug
Using the @agent macro causes an error.

Minimal Working Example

The code is from a tutorial

using Agents
using Random, LinearAlgebra

@agent struct Bird(ContinuousAgent{2,Float64})
    speed::Float64
    cohere_factor::Float64
    separation::Float64
    separate_factor::Float64
    match_factor::Float64
    visual_distance::Float64
end

The error message reads:

ERROR: LoadError: MethodError: no method matching var"@agent"(::LineNumberNode, ::Module, ::Expr)

Closest candidates are:
  var"@agent"(::LineNumberNode, ::Module, ::Any, ::Any, ::Any)
   @ Agents ~/.julia/packages/Agents/xtlGn/src/core/agents.jl:210
  var"@agent"(::LineNumberNode, ::Module, ::Any, ::Any, ::Any, ::Any)
   @ Agents ~/.julia/packages/Agents/xtlGn/src/core/agents.jl:172

Agents.jl version: 5.17.1
julia version: 1.10.4
OS: Linux Mint 21.3 Cinnamon

Version 5 doesn't support this syntax for the macro, you should update to Agents.jl v6 which is the latest major version