-
Notifications
You must be signed in to change notification settings - Fork 125
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
Extend @agent
macro to allow defining default values with Base.@kwdef
#709
Comments
Instead of adding a new macro, could we make it so that |
Additionally, this prompted some thought.
I'm entirely willing to accept that none of these three solutions are satisfactory and the one we have is the easiest and most ergonomic way of doing things, but also thought it best to at least put the ideas out there. |
There is no Julian way to do this because this is not supported from the base language. Im fne with making |
the object orinted way is by far and wide the most intuitive one. It has the smallest learning curve, and requires the least amiunt of effot from the users. it also requires the least amount of effor from us the developers and the least amount of testing. this In conclusion, i don't agree of changing one of the most fundamental designs of Agents.jl, just because base julia doesn't bother to support field inheritance yet. it will at some point in the future. Also, this would be so super breaking I am not sure how many users would like it. |
im almost a fanatic of multiple dispatch. it is the most suitable paradigm for programming. but there are always cases where something else is better. Here for me it is a clear case of the object oriented way being just objectively better. |
Yeah that makes sense. I don't have any problem with the |
I have a working solution, it seems like adding Base.@kwdef to the quote definining the |
so I would extend the |
I make heavy use of
Base.@kwdef
when creating my ABMs because itA simple example:
The new
@agent
macro, which we want to switch to completely at some point in the future, does not allow this:This is naturally the case because
Main.@kwdef
doesn't know what to do with an@agent
macro instead of astruct
. It should be possible to add this functionality to the@agent
macro though. While extending it might be possible, I think it makes more sense to create a new macro called@kwagent
to allow for the expected behaviour.Is anyone (@Datseris @AayushSabharwal @Libbum) against such an extension? If not, I'll try to implement it.
The text was updated successfully, but these errors were encountered: