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

Convert traitfns to use where-syntax #46

Closed
mauro3 opened this issue Aug 11, 2017 · 13 comments · Fixed by #51
Closed

Convert traitfns to use where-syntax #46

mauro3 opened this issue Aug 11, 2017 · 13 comments · Fixed by #51
Assignees

Comments

@mauro3
Copy link
Owner

mauro3 commented Aug 11, 2017

Yep, but needs to wait for JuliaLang/julia#23211

@mauro3 mauro3 self-assigned this Aug 11, 2017
@mauro3
Copy link
Owner Author

mauro3 commented Aug 15, 2017

JuliaLang/julia#23211 is a won't fix, but only affects Julia 0.6. So, either this needs to wait for 0.7 or the syntax needs to be changed. A possibility is:

@traitfn f{X; Tr{X}}(x::X) = 1
# would be
@traitfn f(x::X) where trait(Tr{X})<:Tr{X} where {X} = 1

# Multitrait
@traitfn f(x::X, y::Y) where trait(Tr2{X,Y})<:Tr2{X,Y} where {X,Y} = 1

or using the syntax overhauls proposed in #45

@traitfn f(x::X) where Tr(X)<:Tr where {X} = 1

# Multitrait
@traitfn f(x::X, y::Y) where Tr2(X,Y)<:Tr2 where {X,Y} = 1

The nice thing about this is that it clearly states that a computation on the types, e.g. Tr2(X,Y) is done, and that the result of that is then compared to some type. X-ref: https://discourse.julialang.org/t/why-does-julia-not-support-multiple-traits/5278/25, JuliaLang/julia#18457 (comment)

@sbromberger
Copy link

@mauro3 - would it be possible to tag a 0.7-only version of SimpleTraits so we can start migrating LightGraphs using the new where syntax?

@mauro3
Copy link
Owner Author

mauro3 commented Jan 2, 2018

Yes, but I would rather wait for feature freeze to happen before spending time chasing 0.7.

@sbromberger
Copy link

sbromberger commented Jan 2, 2018

Makes sense to me :) Thanks.

(Though didn't feature freeze happen on December 15?)

@mauro3
Copy link
Owner Author

mauro3 commented Jan 3, 2018

No, it didn't quite yet, but should soon: https://discourse.julialang.org/t/1-0-feature-freeze-dec-15th/7209/28

@sbromberger
Copy link

https://discourse.julialang.org/t/1-0-feature-freeze-dec-15th/7209/34 - any way we might be able to start soon?

@mauro3
Copy link
Owner Author

mauro3 commented Feb 3, 2018

I haven't forgotten this but I have not found the time yet. Sorry! Hopefully the week after next.

@mauro3
Copy link
Owner Author

mauro3 commented Feb 19, 2018

@sbromberger (or @rohitvarkey ): I fixed the where-syntax issue in #51. Maybe you can give that branch a spin?

mauro3 added a commit that referenced this issue Feb 19, 2018
@sbromberger
Copy link

@mauro3 working on it now. Hopefully will have results soon.

@sbromberger
Copy link

@mauro3 things seem to be working very well with this branch. Thank you.

@sbromberger
Copy link

@mauro3 - any chance you could tag this? We're moving ahead with sbromberger/LightGraphs.jl#848 since there are a large number of deprecations we need to fix prior to 0.7. Being able to reference it it REQUIRES would be awesome.

mauro3 added a commit that referenced this issue Feb 20, 2018
Fixed all other deprecations also

Update NEWS, README, CI and REQUIRE

Also revert disabled IsConcrete-test
mauro3 added a commit that referenced this issue Feb 20, 2018
Fixed all other deprecations also

Update NEWS, README, CI and REQUIRE

Also revert disabled IsConcrete-test
@mauro3
Copy link
Owner Author

mauro3 commented Feb 20, 2018

Tagged: JuliaLang/METADATA.jl#13453

@sbromberger
Copy link

Perfect. Thank you :)

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