Skip to content

Simplify "value type (Val)" usage #346

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

Closed
wants to merge 6 commits into from
Closed

Conversation

expnn
Copy link

@expnn expnn commented Nov 21, 2017

In 0.7, Val(N) is the instance of Val{N}, so it does not require Type{Val{N}} any more.

julia> isa(Val(4), Val{4})
true

Even though, this is not true for 0.6 and early versions of julia, all tests are passed till now.

@c42f
Copy link
Member

c42f commented Nov 22, 2017

Looks like a good simplification, thanks. Compat defines the Val(N) constructor, so you can rely on this being available.

However, this is a rather large breaking change to the public API - I think it deserves a round of deprecations at least, and possibly just continued support for both versions until 0.7 is out. (In fact, I wonder whether constant propagation will be powerful enough in 0.7 that we can remove some of these.)

There's two general cases:

  1. Functions where we needed to break compatibility with Base to get the output type inferred (eg, diagm)
  2. Functions where we use exactly the same input types as Base (eg, the pivot argument to lu).

For the first case, it seems we could do a round of deprecations, and just go with Val(N) immediately. For the second case, I'd be uncomfortable about breaking consistency with 0.6 until 0.7 is out, and I think we should continue to support both versions until 0.7 has been released.

So, from my point of view, here's a plan to get this merged: (1) Make a depwarn version of all functions in class (1). For all functions in class (2) create a version which takes the old arguments and forwards them to your new version.

BTW, the CI tests are currently failing in LU, so I think there's some more work to do there.

Thanks for contributing!

@c42f
Copy link
Member

c42f commented Nov 22, 2017

Actually on further reflection, perhaps we should postpone merging this until it's clearer what the situation regarding constant propagation will actually be in 0.7? It could be that we can just remove most of our uses of Val entirely which would allow us to be exactly compatible with Base. See for example JuliaLang/julia#24011 and linked issues.

It would be unfortunate to force users of StaticArrays through an extra unnecessary deprecation cycle.

@c42f
Copy link
Member

c42f commented Aug 1, 2019

Seems this was sorted out in #473 and elsewhere. Sorry we dropped the ball on this PR :-/

@c42f c42f closed this Aug 1, 2019
@c42f c42f added the cleanup label Aug 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants