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

unpack into renamed local variables #18

Open
tpapp opened this issue Feb 25, 2022 · 0 comments · May be fixed by #22
Open

unpack into renamed local variables #18

tpapp opened this issue Feb 25, 2022 · 0 comments · May be fixed by #22

Comments

@tpapp
Copy link
Contributor

tpapp commented Feb 25, 2022

Sometimes one wants to unpack values of two similar (or the same) types in a local scope and then variable names clash. A typical example is implementing an operator or some types, eg

function Base.==(x::MyAB, y::MyAB)
    x.a == y.a && x.b == y.b
end

Cf common-lisp:with-slots. I wonder if there is some syntax we could co-opt for this purpose.

tpapp added a commit to tpapp/UnPack.jl that referenced this issue Nov 18, 2022
Fixes mauro3#18.

Incidental changes:

- wrap some tests into testsets, so that we can use `@isdefined` in tests

- add more validation of input expressions, test for expressions that
  are invalid but were expanded and failed with an obscure error message
@tpapp tpapp linked a pull request Nov 18, 2022 that will close this issue
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 a pull request may close this issue.

1 participant