OFFIS-DAI / Mango.jl

Modular Julia-based agent framework to implement multi-agent systems
https://offis-dai.github.io/Mango.jl/stable/
MIT License
8 stars 2 forks source link

Role agent macro overhaul #61

Closed rcschrg closed 2 months ago

rcschrg commented 2 months ago

This PR simplifies @agent and @role and introduces @with_def, which will convert any struct with defaults (ABC::Int = 0) to an interpretable syntax with defaults in a default arg and kwargs constructor.

The core difference between @with_def and @kwdef is, that @kwdef will introduce a keyword parameter for every field in the default constructor, while @with_def only uses keyword arguments if a default value has been given.

@with_def struct ABC 
    has_default::Bool = false
    no_default::Bool
end

will create the constructor

function ABC(no_default; has_default=false) ...