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

Add @compat for standard library imports #403

Closed
wants to merge 1 commit into from
Closed

Conversation

TotalVerb
Copy link
Contributor

@TotalVerb TotalVerb commented Oct 2, 2017

Alternative to #404.

See JuliaLang/julia#23931.

The SharedArrays module is emulated instead of real.

@TotalVerb TotalVerb force-pushed the fw/stdlib branch 2 times, most recently from 4ccbeec to 7ed229e Compare October 2, 2017 20:22
Copy link
Contributor

@yuyichao yuyichao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be done with module aliases instead of syntax rewrite. The user should write using Compat.Test etc.

test/runtests.jl Outdated
# 0.7
module Test23876
using Compat
@compat importall Test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also importall is being deprecated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I'll avoid rewriting importall then

@TotalVerb
Copy link
Contributor Author

Module aliasing would force loading all the standard library modules as soon as Compatible loads, however.

@yuyichao
Copy link
Contributor

yuyichao commented Oct 2, 2017

They are anyway.

@TotalVerb
Copy link
Contributor Author

Even so, module aliasing here introduces parts of Compat that will eventually need to be deprecated and migrated again, whereas the syntax rewriting can be removed later without deprecation.

@TotalVerb
Copy link
Contributor Author

TotalVerb commented Oct 2, 2017

Alternatively, we could consider registering stub modules Test, SharedArrays, etc. that are restricted on METADATA for versions 0.6 and below? Though these version-conditional dependencies would not play nice with the existing REQUIRE format.

@yuyichao
Copy link
Contributor

yuyichao commented Oct 2, 2017

that will eventually need to be deprecated and migrated again

Yes? What's the problem? It doesn't change the fact that syntax rewrite is always the least preferred way to handle version compatibility, especially for a non-syntax change.

registering stub modules Test, SharedArrays, etc

That can also work.

@TotalVerb
Copy link
Contributor Author

I agree in principle, but it just seems more elegant to be able to do @compat using Test instead of using Compat.Test. Would someone else like to comment?

@TotalVerb
Copy link
Contributor Author

Replaced by #404.

@TotalVerb TotalVerb closed this Oct 6, 2017
@TotalVerb TotalVerb deleted the fw/stdlib branch October 6, 2017 22:35
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 this pull request may close these issues.

2 participants