Skip to content

qualify uses of Not #83

@bgctw

Description

@bgctw

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.

Activity

mauro3

mauro3 commented on Oct 2, 2022

@mauro3
Owner

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.

added a commit that references this issue on Oct 2, 2022
ba5465d
mauro3

mauro3 commented on Oct 2, 2022

@mauro3
Owner

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

bgctw

bgctw commented on Oct 4, 2022

@bgctw
Author

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

bgctw commented on Oct 4, 2022

@bgctw
Author

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.

added a commit that references this issue on Oct 4, 2022
added a commit that references this issue on Oct 4, 2022
mauro3

mauro3 commented on Oct 4, 2022

@mauro3
Owner

No, better do:

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

as import allows method-addition/overwriting.

mauro3

mauro3 commented on Aug 6, 2025

@mauro3
Owner

Fixed with #97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @mauro3@bgctw

      Issue actions

        qualify uses of Not · Issue #83 · mauro3/SimpleTraits.jl