Closed tk3369 closed 4 years ago
Merging #47 into master will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## master #47 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 7 7
Lines 239 241 +2
=========================================
+ Hits 239 241 +2
Impacted Files | Coverage Δ | |
---|---|---|
src/BinaryTraits.jl | 100.00% <ø> (ø) |
|
src/misc.jl | 100.00% <ø> (ø) |
|
src/assignment.jl | 100.00% <100.00%> (ø) |
|
src/interface.jl | 100.00% <100.00%> (ø) |
|
src/trait.jl | 100.00% <100.00%> (ø) |
|
src/types.jl | 100.00% <100.00%> (ø) |
|
src/utils.jl | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 0acedd6...7ec65aa. Read the comment docs.
Alright, this PR is pretty much ready to go. I'm planning to merge to master and announce to the community this weekend. Please review code if possible. Additional changes are listed as follows:
While updating documentations, I realized that some functions are not consistently named. I have changed them as follows:
istrait
renamed to is_trait
inittraits
renamed to init_traits
set_verbose
renamed to set_verbose!
I used to call the super-type a trait e.g. Fly
would be a trait. Then, the positive and negative types were "can-type" and "cannot-type" (or "can-trait" or "cannot-trait"). Honestly, this naming scheme is quite awkward.
I realized that it's OK to just refer the positive and negative trait types as traits. So Can{Fly}
is a trait and Cannot{Fly}
is also a trait. Then, what do we call the abstract type Fly
itself? I don't know. Suggestions welcome. For now, I have made the is_trait
function to return true
for all of them.
This PR is to implement the idea as described in #23
An interesting artifact of switching to this design is that the commonly-used trait prefix types (Can, Is, Not, etc.) are predefined as aliases to
Positive
andNegative
prefix types. In order to avoid polluting the namespace, they are defined in a submoduleBinaryTraits.Prefix
. The user just needs to import whatever they need like this:Thinking further ahead, the
prefix clause
in@trait
macro becomes a little redundant. It feels somewhat convenient though. So, I have kept the code and and make it auto-import the prefix types for now.Cc: @KlausC @akels