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

Use @dispatch instead of branching for multiagent models #1034

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft

Conversation

Tortar
Copy link
Member

@Tortar Tortar commented May 11, 2024

Still a bit experimental in MixedStructTypes, so this still needs some adjustments, but I'd like to know what you think about this @Datseris (I'm still a bit unsure about the name of the macro). In practice what it does is to reconstruct the branching for the user. Actually in some more advanced cases, it could be more complicated to write the branching, with this it should be a lot easier.

@Datseris
Copy link
Member

so what's the documentation? If I am a user wanting to learn, what do I read?

@Tortar
Copy link
Member Author

Tortar commented May 12, 2024

Currently, there is a section in the ReadMe in MixedStructTypes describing it (https://github.com/JuliaDynamics/MixedStructTypes.jl?tab=readme-ov-file#define-functions-operating-with-the-mixed-structs) , but needs to be expanded.

In Agents.jl we probably need to add it to the tutorial when describing the multiagent macro.

@Datseris
Copy link
Member

Okay, so this is a non-breaking addition that allows using a "multiple dispatch" like syntax for @multiagent. That seems totally fine for me. How aobut you give a shot at documenting this in the tutorial and we see how the final producct looks?

@Tortar
Copy link
Member Author

Tortar commented May 12, 2024

Maybe this is good enough? I will wait a little bit before merging anyway because I need still to improve a bit more the macro

@Datseris
Copy link
Member

Datseris commented Jun 2, 2024

I don't think it is a good idea to go all in into the @dispach. In general, keep in mind, macros are a concept that really only Julia uses from mainstream languages. Users coming from Java, C, Python, R, don't really use macros in typical user code. I think it is best if in the tutorial we first show the non-macro versions for everything, and then show the macro version and say "look, the macro version is created so that @multiagent is as harmonious as standard Julia multiple dispatch". (although, itself MD is also advanced concept that only Julia uses)

@Tortar
Copy link
Member Author

Tortar commented Jun 2, 2024

Yes, I think you are right, I just demonstrated the branching version before the macro one now in the event-based tutorial. Now it should be good to go...but actually I still need to register the package so we need to wait a little bit more :D

@Datseris
Copy link
Member

Datseris commented Jun 2, 2024

register which package? edit: okay saw the rename.

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

Successfully merging this pull request may close these issues.

None yet

2 participants