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

Update to v0.2 of MixedStructTypes #972

Merged
merged 6 commits into from
Feb 11, 2024
Merged

Update to v0.2 of MixedStructTypes #972

merged 6 commits into from
Feb 11, 2024

Conversation

Tortar
Copy link
Member

@Tortar Tortar commented Feb 9, 2024

Fixes #968
Fixes #967

I slightly changed the syntax in that package, and also solved some issues with the macros

@Tortar Tortar closed this Feb 9, 2024
@Tortar Tortar reopened this Feb 9, 2024
@Tortar Tortar requested a review from Datseris February 9, 2024 20:45
@Tortar
Copy link
Member Author

Tortar commented Feb 9, 2024

If I can kindly ask you George, can you give me your opinion on the syntax of https://github.com/JuliaDynamics/MixedStructTypes.jl? Do you think it is okay? :-)

@Tortar
Copy link
Member Author

Tortar commented Feb 10, 2024

mmh actually again an instance of #963

@Datseris
Copy link
Member

Hi @Tortar I am available today. I Can review. But this still seems to be WIP, right? What would you like me to review from MixedStructTypes.jl?

@Tortar
Copy link
Member Author

Tortar commented Feb 11, 2024

It should be ready for review now actually

@Tortar
Copy link
Member Author

Tortar commented Feb 11, 2024

nevermind for MixedStructTypes.jl, it seems okay to me

@Datseris
Copy link
Member

right, so what's the status now? what's the syntax, if it changed?

@Tortar
Copy link
Member Author

Tortar commented Feb 11, 2024

No I mean no changes still to the syntax, will do that in a separate PR, I meant to say that the syntax changed in MixedStructTypes.jl and so I adjusted the macro to the new one

@Datseris
Copy link
Member

Right. but what is the syntax change? It is not obvious to me by just looking at the readme.

@Tortar
Copy link
Member Author

Tortar commented Feb 11, 2024

From e.g. :

@sum_struct_type @kwdef A{X} <: AbstractA{X} begin
           mutable struct B{X}
               a::Tuple{X, X} = (1,1)
               b::Tuple{Float64, Float64} = (1.0, 1.0)
           end
           mutable struct C
               a::Tuple{Int, Int} = (2,2)
               d::Int32 = Int32(2)
           end
           mutable struct D
               a::Tuple{Int, Int} = (3,3)
               const c::Symbol = :s
           end
           struct E{X}
               a::Tuple{X, X} = (3,3)
           end
       end

to:

@sum_structs A{X} <: AbstractA{X} begin
           @kwdef mutable struct B{X}
               a::Tuple{X, X} = (1,1)
               b::Tuple{Float64, Float64} = (1.0, 1.0)
           end
           @kwdef mutable struct C
               a::Tuple{Int, Int} = (2,2)
               d::Int32 = Int32(2)
           end
           @kwdef mutable struct D
               a::Tuple{Int, Int} = (3,3)
               const c::Symbol = :s
           end
           @kwdef struct E{X}
               a::Tuple{X, X} = (3,3)
           end
       end

In practice a shorter name for the macro and a finer control on kwdef (you can apply it to just some structs if you want)

This makes the macros even more similar to just write the structs and apply the macro afterwards

@Datseris
Copy link
Member

Datseris commented Feb 11, 2024

right, but how is its application Agents.jl? do the subagents start with @subagent or not anymore? I guess its better if they don't? (I also find odd the usage of @kwdef . can you remove it?) I guess @kwdef is not in the Agents.jl version.

@Tortar
Copy link
Member Author

Tortar commented Feb 11, 2024

No changes to the Agents.jl syntax were made, I haven't applied the new syntax @subagent, etc..., I will do it in another PR, so I think this PR is good to go as it is

@Datseris Datseris merged commit 9df313b into main Feb 11, 2024
1 of 5 checks passed
@Datseris Datseris deleted the up branch February 11, 2024 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants