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

qualify uses of Not #83

Open
bgctw opened this issue Sep 30, 2022 · 5 comments · May be fixed by #84
Open

qualify uses of Not #83

bgctw opened this issue Sep 30, 2022 · 5 comments · May be fixed by #84

Comments

@bgctw
Copy link

bgctw commented Sep 30, 2022

When importing both SimpleTraits and DataFrames, I do not figure out how to deal with
"both DataFrames and SimpleTraits export "Not"; uses of it in module TwPrototypes must be qualified"

Specifically, SimpleTraits somehow inlines unqualified usages of Not somewhere in the code, which I do not know how to transform to qualified, which causes compiler errors "UndefVarError: Not not defined" -> with stack traces leading into SimpleTraits source code.
e.g.
@ ~/scratch/twutz/julia_cluster_depots/packages/SimpleTraits/l1ZsK/src/SimpleTraits.jl:171 [inlined]

I suggest as a first measure to replace "Not" by "SimpleTraits.Not" in all the code of SimpleTraits.

Is it possible to not export Not from SimpleTraits? Would this break too much depending code - which would need to adapt and qualify their usages of Not?
Personally, I did not use Not explicitly yet (but obviously implicitly via macro) in my code.

@mauro3
Copy link
Owner

mauro3 commented Oct 2, 2022

Yes, the Not within the macro generated code should should be qualified. Needs fixing.

Once that is fixed, you could just be specific with what you use:

using SimpleTraits: Trait, istrait, @traitdef, @traitimpl, @traitfn

That is probably all that you need, without the Not.

mauro3 added a commit that referenced this issue Oct 2, 2022
Fixes #83

Also did some renames to use `$curmod` instead of `SimpleTraits` everywhere.
@mauro3 mauro3 linked a pull request Oct 2, 2022 that will close this issue
@mauro3
Copy link
Owner

mauro3 commented Oct 2, 2022

If you have time you could try out PR #84.

@bgctw
Copy link
Author

bgctw commented Oct 4, 2022

Thanks for taking this up so quickly.
I was, unfortunately, not able to test the package dependencies on your specific commit. I only got error (using Julia 1.8.1):

(TwPrototypes) pkg> add SimpleTraits#ba5465d783177da9328f63a549b84ca4f451e7ba
     Cloning git-repo `https://github.com/mauro3/SimpleTraits.jl.git`
ERROR: failed to clone from https://github.com/mauro3/SimpleTraits.jl.git, error: GitError(Code:ERROR, Class:Zlib, error reading from the zlib stream)

@bgctw
Copy link
Author

bgctw commented Oct 4, 2022

Thanks. Yes this works.
In addition to the specific imports, I had to say

import SimpleTraits

to prevent errors in inlined code from SimpleTraits source where SimpleTraits module is used to qualify names.

bgctw added a commit to bgctw/TwPrototypes.jl that referenced this issue Oct 4, 2022
bgctw added a commit to bgctw/TwPrototypes.jl that referenced this issue Oct 4, 2022
@mauro3
Copy link
Owner

mauro3 commented Oct 4, 2022

No, better do:

using SimpleTraits: SimpleTraits, Trait, istrait, @traitdef, @traitimpl, @traitfn

as import allows method-addition/overwriting.

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.

2 participants