-
-
Notifications
You must be signed in to change notification settings - Fork 706
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
std.algorithm cleanup #2996
std.algorithm cleanup #2996
Conversation
|
Thanks! Was |
Meant to say: was it available in 2.066? |
|
Hmm, git history indicates that it was added in 2012, so we definitely need to forward it to the new location. I'm uneasy about using a public import, though... wouldn't that pollute std.algorithm with std.functional symbols? It might also cause new conflicts. Is there a way to publicly import a specific symbol? |
Add forwarding alias to std.functional.forward to prevent breaking existing code.
|
Also, should there be a deprecation message to point users to the new location of |
It appears that it already is that way, as your change removes that import. Can you statically import it, and than alias the symbol?
I think you can simply import the symbol you want directly, no?
Yes, so probably the right way to do this is to use a deprecated alias. |
|
I used a private import. Is a static import better? What side effects might it have? I remember that imports have some quirky semantics when it comes to visibility. And for some reason, adding a deprecation clause to the alias doesn't seem to trigger a deprecation error even when compiling with |
|
Alright, I'm adding it anyway, since I don't have time to babysit this all day. At least when the compiler is fixed the message will appear. For now it will just be a transparent alias. |
I think a static import prevents the import of std.functional's symbols into std.algorithm's namespace. Basically, you have to say The deprecation message should work, I tested it on a small example, exactly as you have it, and a message is printed. |
|
Note that if you happen to have imported std.functional elsewhere (not via std.algorithm), you will not hit the alias. |
|
Maybe my compiler is broken, I'll try to recompile git HEAD and see if the message appears. In the meantime, I've changed it to a static import with a deprecation message. Should be ready to merge if there are no other issues. The deprecation message issue, if it's actually a real issue, can be done separately, no need to hold up this PR just because of that. |
|
I guess, it is the |
|
Seems good to me. |
|
Auto-merge toggled on |
yes, that's likely it. In reality, this means the alias will not be hit, since importing std.algorithm means you will import std.algorithm.comparison. However, in the event that private imports actually do become private, then the alias will be effective. |
forwardtostd.functionalSortOutputtostd.algorithm.sortingstd/algorithm/package.d.