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

@pack_MyType #107

Closed
Petr-Hlavenka opened this issue Nov 7, 2019 · 1 comment
Closed

@pack_MyType #107

Petr-Hlavenka opened this issue Nov 7, 2019 · 1 comment

Comments

@Petr-Hlavenka
Copy link

As I understand how the new @pack_* works:

@with_kw struct MM
    r = "val_def"
    a = "cnt_def"
end
m = @pack_MM #error, r not defined
r= "val_1"
a = "cnt_2"
m = @pack_MM  #OK

I'm missing the functionality where I could just tell the macro which variables to pack - the same way the @pack! macro works

@pack_MM m_new = a #use a and default r

Is that a complex task to incorporate into current code? I admit I don't understand the meta-programming so I have no idea how difficult such change is.

@mauro3
Copy link
Owner

mauro3 commented Nov 22, 2019

Why not just

m = MM(a=a)

or if you have an m already

m_new = MM(m, a=a)

Also, look into Setfield.jl.

So, I'll close this. But let me know if you think this is not addressed properly.

@mauro3 mauro3 closed this as completed Nov 22, 2019
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

No branches or pull requests

2 participants