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

need mechanism to deprecate bindings #11200

Closed
timholy opened this issue May 8, 2015 · 13 comments
Closed

need mechanism to deprecate bindings #11200

timholy opened this issue May 8, 2015 · 13 comments
Assignees
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request

Comments

@timholy
Copy link
Member

timholy commented May 8, 2015

While we can deprecate functions, our current mechanism to deprecate types is to define the equivalent of

export Range1
const Range1 = UnitRange

This does not trigger any deprecation warning for using the type itself. #11046 was therefore more disruptive than one might have ideally wished (see JuliaGraphics/Tk.jl#98 and cascading breakages in any package that depends on it, plus at least timholy/ProfileView.jl#32), in that it caused actual package breakages. If we'd had a deprecation system in place, the appropriate changes could have been made any time in the past year.

I presume this is something that needs to be handled at the parser level?

(Off-topic: should we have a "wishlist" label as distinct from bug reports?)

@timholy timholy added help wanted Indicates that a maintainer wants help on an issue or pull request parser Language parsing and surface syntax labels May 8, 2015
@jakebolewski
Copy link
Member

You can't really do this at the parser level because it is perfectly valid to use the name of a Type as a local variable.

julia> type MyType
       x::Int
       end

julia> let MyType = 1
       @show MyType
       end
MyType = 1
1

julia> MyType(10)
MyType(10)

@jakebolewski jakebolewski removed the parser Language parsing and surface syntax label May 8, 2015
@timholy
Copy link
Member Author

timholy commented May 8, 2015

Good point. Thanks for taking that label off.

@jakebolewski
Copy link
Member

But I agree this is big problem that will trigger all sorts of compatibility issues going forward.

It makes it impossible to implement improvements such as #8240 because the result will be backwards incompatible with no clear deprecation path.

@StefanKarpinski
Copy link
Member

This has come up before, what's really needed it seems, is to have a deprecated export mechanism, where a name can be made available, but using it triggers a warning in the other module.

@StefanKarpinski
Copy link
Member

That distinction would be more broadly useful: e.g. if two module both export names but one of the exports is deprecated, maybe the non-deprecated name should win? It would also be nice not to tab complete deprecated names and methods.

@ScottPJones
Copy link
Contributor

👍 @StefanKarpinski Any how hard to implement deprecated export mechanism, allowing non-deprecated name to win, and no tab completion?

@StefanKarpinski
Copy link
Member

It would be a fair amount of work that not very many people could do.

@ScottPJones
Copy link
Contributor

@StefanKarpinski Be careful about making challenges like that! 😀

@StefanKarpinski
Copy link
Member

Well, I'd be happy for anyone to do it, but it just involves a whole lot of Julia blood and guts.

@ScottPJones
Copy link
Contributor

Julia blood and guts? But, that's the most fun part, for an old language design / compiler guy like me! 😀 Seriously, if you already know approximately what areas would need to be dug into, and could point them out, then that's something else where I might be able to take a crack at it...

@jiahao
Copy link
Member

jiahao commented May 8, 2015

#9830 is a special case of this problem, I think.

@StefanKarpinski
Copy link
Member

Changed title to reflect that what's mostly needed is a mechanism to deprecate bindings.

@JeffBezanson JeffBezanson self-assigned this Sep 15, 2015
JeffBezanson added a commit that referenced this issue Sep 16, 2015
This is a rather minimal implementation that only really works for
types and functions, since it relies on printing those objects to
show the replacement. Fortunately all existing deprecated bindings
are for types.

This also avoids tab-completing deprecated names, by excluding them
from the result of `names`. The tradeoff is that it's now
impossible to enumerate deprecated names by reflection. Hopefully
that will be ok.

We could add `deprecate(:f)` calls for functions that are
entirely deprecated. Then they would be excluded from tab
completion as well.

(cherry picked from commit 1b6efc7)
@tkelman
Copy link
Contributor

tkelman commented Sep 16, 2015

backported in #13107

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request
Projects
None yet
Development

No branches or pull requests

7 participants