In Agents.jl, any agent type being made from calling @agent is mutable, but with Julia versions >= 1.8 now we can specify particular fields as being const, which can help bring performance closer to immutable structs (see Types · The Julia Language). It would be nice to let users to specify fields as const if they like, to improve performance.
Related issue:
Question:
Is it possible to embed const syntax in @agent macro, as follows:
@agent YourAgentType{X} AnotherAgentType [OptionalSupertype] begin
extra_property::X
other_extra_property::Int
const immutable_property::X # immutable type
# etc...
end
Note that this will not even parse at all:
ERROR: syntax: expected assignment after "const"
It would be possible to rework the @agent syntax, to use: