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

Re-export Cow from prelude #2672

Closed
wants to merge 1 commit into from

Conversation

sgrif
Copy link
Contributor

@sgrif sgrif commented Apr 1, 2019

@Manishearth
Copy link
Member

@rfcbot concern potential-cheese-extension

It occurs to me that eventually we may want to extend 🐄 to support 🥛, 🧀, and eventually 🍕. These are all delicious and it feels reasonable to assume that the community will feel a need for such delectable goods.

Is it possible to future-proof this RFC for these designs?

Furthermore, do we need to resolve whether 🍕 would be compatible with 🍍? It feels like this will be an issue down the road.

I'm reluctant to expand the scope of this RFC so broadly, however, I'd like us to get this right with a holistic design so we don't paint ourselves into a corner in the future.

@Diggsey
Copy link
Contributor

Diggsey commented Apr 1, 2019

image

@mgattozzi
Copy link
Contributor

I'd like to also bring up the fact that we might actually want to implement a Cow trait here instead since many things can derive from it. While @Manishearth has brought up the fact that we might have 🥛, 🧀, and 🍕 we're also excluding a whole list of Cow derived items such as 🍦, 🎂, 🍨, and 🥞 to name a few.

@jeffparsons
Copy link
Contributor

Wouldn't it be better to experiment with this out-of-tree first? Of course the obvious crate name for such an experiment would be "🐄", so crates.io will need to be taught to support Unicode crate names, too. But presumably that's pretty high on the roadmap anyway, so we could use this as an excuse to finally get that done.

@gj
Copy link

gj commented Apr 1, 2019

This feels like a dangerous step in the direction of emojicode, and I hope the core team will think long and hard before opening this COW (container on wheels).

- City of Waterloo
- Crush of the Week
- Container on Wheels
- Cost of Waste
Copy link
Member

Choose a reason for hiding this comment

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

The author seems unaware that a common meaning of COW in computer science is “copy on write”, a common optimization to avoid wasting space/time when making copies of some object.

For example, in Unix-based operating systems, COW is used as an optimization when forking a process. Rather than copying the contents of all memory to the new process’s address space, the kernel orders a new computer for the user and runs the new child process on the new computer. When writes are done to the address space on the child process, they are copied to the old conputer so the kernel is aware of them (hence the name “copy on write”).

@cetra3
Copy link

cetra3 commented Apr 1, 2019

Can we also export Box with 📦?


to name a few. For this reason, the re-export of this type must be something
which is unlikely or impossible to appear in Rust programs today. For this
reason, the export will be defined as `pub use core::borrow::Cow as 🐄;`. As the
Copy link
Member

Choose a reason for hiding this comment

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

Please provide the code point value for 🐄 just like 🐮, ☭, Ferris and Steve below

identifiers which may be used in Rust today, two characters from the Unicode
private use area will be used instead.

`Borrowed` will be exported as U+FF8E, and `Owned` will be exported as U+FF8F.
Copy link
Member

Choose a reason for hiding this comment

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

ホ and マ do not look like private use characters. The PUA in BMP is U+E000 – U+F8FF.

@ZhangHanDong
Copy link

I was fooled.

@Centril Centril added T-lang Relevant to the language team, which will review and decide on the RFC. T-libs-api Relevant to the library API team, which will review and decide on the RFC. A-non-ascii-idents Proposals relating to non-ascii identifiers A-prelude Proposals relating to the prelude. labels Apr 1, 2019
@Centril
Copy link
Contributor

Centril commented Apr 1, 2019

In the 2019 roadmap RFC we said that we would work to achieve:

Key ergonomic improvements

By reexporting 🐄 to the prelude, this clearly happens. As such, let's @rfcbot merge !

However...

Cow::Borrowed would be exported as U+262D HAMMER AND SICKLE, ☭. This is because ownership is theft. No further explanation is required.

This does not feel very readable. Can we use Ⓐ instead?

@pietroalbini
Copy link
Member

This does not feel very readable. Can we use Ⓐ instead?

I feel like that should be reserved as a replacement for unsafe though.

@rodrimati1992
Copy link

I feel like that should be reserved as a replacement for unsafe though.

If we start reserving Unicode identifiers,I think would be better for marking unsafe code.

@Centril
Copy link
Contributor

Centril commented Apr 1, 2019

As such, let's @rfcbot merge !

It feels like @rfcbot has a bug or something... let's try this again.

@rfcbot merge

@rfcbot
Copy link
Collaborator

rfcbot commented Apr 1, 2019

Team member @Centril has proposed to merge this. The next step is review by the rest of the tagged team members:

Concerns:

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Currently awaiting signoff of all team members in order to enter the final comment period. disposition-merge This RFC is in PFCP or FCP with a disposition to merge it. labels Apr 1, 2019
@kennytm
Copy link
Member

kennytm commented Apr 1, 2019

If we start reserving Unicode identifiers,I think ☢ would be better for marking unsafe code.

This could be confused as the replacement of std::sync::atomic though, which is pretty safe and efficient.

@Centril
Copy link
Contributor

Centril commented Apr 1, 2019

This could be confused as the replacement of std::atomic though, which is pretty safe and efficient.

There's always ☠️ { ... }.
Feels pretty clear.

@Centril
Copy link
Contributor

Centril commented Apr 1, 2019

@rfcbot concern potential-cheese-extension

on behalf of @Manishearth.

@xTibor
Copy link

xTibor commented Apr 1, 2019

Cow::Borrowed would be exported as U+262D HAMMER AND SICKLE, ☭. This is because ownership is theft. No further explanation is required.

This would mean the end of my Rust career and possibly for other people coming from the former Eastern Bloc countries. Law here [1] prohibits the public use and display of symbols of totalitarianism including all communist symbols like red stars, hammer and sickles. If this change goes through I could be punished by custodial arrest just by writing Rust code and publishing it on my public GitHub profile.

[1] https://en.wikipedia.org/wiki/Bans_on_Communist_symbols

@nagisa
Copy link
Member

nagisa commented Apr 2, 2019

Now that it is April the 2nd and the horror of the day that was prior to this relief has subsided, I would like to comment that I actually kinda like the idea of exporting Cow. There are no portability concerns as prelude names are shadowed if another Cow is imported or defined in the scope.

@nagisa
Copy link
Member

nagisa commented Apr 2, 2019

@rfcbot concern no-chance-to-have-this-considered-seriously??!

@cramertj
Copy link
Member

cramertj commented Apr 2, 2019

@xTibor

This would mean the end of my Rust career and possibly for other people coming from the former Eastern Bloc countries. Law here [1] prohibits the public use and display of symbols of totalitarianism including all communist symbols like red stars, hammer and sickles. If this change goes through I could be punished by custodial arrest just by writing Rust code and publishing it on my public GitHub profile.

If it wasn't clear, this whole thread is heavily in jest and we certainly would not use a symbol like that for anything real. That said, it is perhaps worthwhile to remind folks that we're striving to be an inclusive community and want to be thoughtful about the jokes we make, especially around politics and issues with significant historical baggage.

@xTibor
Copy link

xTibor commented Apr 2, 2019

If it wasn't clear...

It was perfectly clear for me, it's just an overdramatized shitpost :)

@joshtriplett joshtriplett added the april-1st RFCs started on the 1st of april. label Apr 2, 2019
@joshtriplett
Copy link
Member

@nagisa I'd like to see Cow in the prelude as well (under the name Cow). (I don't think we need to re-export the constructors directly, unlike Some; it seems fine and even preferable to write Cow::Borrowed.)

I don't think re-using this thread is a good idea. Would someone like to supply a serious RFC for the re-exporting of Cow from the prelude?

@sgrif
Copy link
Contributor Author

sgrif commented Apr 2, 2019

Yeah, I can draft a serious RFC later this week. As it's now April 2 in UTC, I'm going to shut this one down. Thanks for the fun day folks!

@sgrif sgrif closed this Apr 2, 2019
@rfcbot rfcbot removed proposed-final-comment-period Currently awaiting signoff of all team members in order to enter the final comment period. disposition-merge This RFC is in PFCP or FCP with a disposition to merge it. labels Apr 2, 2019
@rust-lang rust-lang locked as off-topic and limited conversation to collaborators Apr 2, 2019
@scottmcm

This comment has been minimized.

@Manishearth

This comment has been minimized.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-non-ascii-idents Proposals relating to non-ascii identifiers A-prelude Proposals relating to the prelude. april-1st RFCs started on the 1st of april. T-lang Relevant to the language team, which will review and decide on the RFC. T-libs-api Relevant to the library API team, which will review and decide on the RFC.
Projects
None yet
Development

Successfully merging this pull request may close these issues.