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

Reserve name `Str` while it's not too late #1208

Closed
petrochenkov opened this Issue Jul 13, 2015 · 3 comments

Comments

Projects
None yet
1 participant
@petrochenkov
Copy link
Contributor

petrochenkov commented Jul 13, 2015

If str is ever moved to the library, as was planned, it would be good for it to follow the library conventions.
It's likely that even if hypothetical 2.0 allows moderate breaking changes, it will still not be able to use the name Str for practical compatibility reasons. Now (before 1.2), while the language is not widely used, it still might be possible to reserve the name by putting it into the prelude.

Detailed design:

  1. Put type Str = str; somewhere in libcore.
  2. Reexport Str from the libstd prelude
  3. Evaluate the impact with crater
  4. ??? (depends on the previous item)
@petrochenkov

This comment has been minimized.

Copy link
Contributor Author

petrochenkov commented Jul 13, 2015

ping @aturon @Gankro
or someone else from the library team?

@petrochenkov

This comment has been minimized.

Copy link
Contributor Author

petrochenkov commented Jul 13, 2015

I've tested the change on Rust itself (branch) - nothing breaks. Name Str is sometimes used, but only in value namespace and not type namespace, so it's not affected.

@petrochenkov

This comment has been minimized.

Copy link
Contributor Author

petrochenkov commented Jul 13, 2015

Ok, it looks like names in the prelude are "weak" and can be redefined in user code without conflicts.

type String = u8; // Compiles, and now String is u8 in the current module

So, putting Str into the prelude later will not be as destructive as it seemed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.