Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Role expose/import data models using a macro #24

Closed
rcschrg opened this issue Mar 22, 2024 · 0 comments · Fixed by #25
Closed

Role expose/import data models using a macro #24

rcschrg opened this issue Mar 22, 2024 · 0 comments · Fixed by #25
Assignees
Labels
enhancement New feature or request

Comments

@rcschrg
Copy link
Member

rcschrg commented Mar 22, 2024

Imagine there is a role holding the neighborhood

@role NeighborhoodRole begin
    neighbors::Array{AgentAdress{Any}}
end

There are reasons to share this data to other roles who also work on the environment. This can be done with
get_model(role, WrapperModel) in setup, then setting the array. However this is boilerplate we might wanna reduce
if we wanna share often used data in roles.

It is desirable to do this declarative, we declare shared data and we declare shared data, e.g.

@role OperatingOnNeighborhoodRole begin
    @shared neighbors::Neighbors
end

The @shared would just initialize the Neighbors model with a similar function as get_model(), and remember to assign the instance to the role handler when added to an agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant