Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upString literal #2206
Comments
This comment has been minimized.
This comment has been minimized.
|
For reference, I believe the most recent discussion on the string literals problem was: https://internals.rust-lang.org/t/pre-rfc-allowing-string-literals-to-be-either-static-str-or-string-similar-to-numeric-literals/5029 Sadly this problem didn't quite fit into this year's ergonomics initiative. |
This comment has been minimized.
This comment has been minimized.
burdges
commented
Nov 4, 2017
|
It frequently improves performance slightly if the code for which you need the As an aside, I'm curious : Is |
This comment has been minimized.
This comment has been minimized.
|
New string prefixes are a breaking change in the presence of |
This comment has been minimized.
This comment has been minimized.
|
It also fits the style of raw strings, being The logic behind |
This comment has been minimized.
This comment has been minimized.
|
Long ago, rust had |
Centril
added
T-lang
breaking-change
labels
Dec 6, 2017
This comment has been minimized.
This comment has been minimized.
warlord500
commented
Mar 29, 2018
|
as much as this might be nice for new comers, i really don't think this would be a good idea! |
This comment has been minimized.
This comment has been minimized.
deifactor
commented
Dec 29, 2018
|
FWIW, one place where I tend to want this is when I've got something like:
and other similar cases where I want to use a string literal as a default value. |
This comment has been minimized.
This comment has been minimized.
Personally, I prefer just using |
ElectricCoffee commentedNov 4, 2017
Constantly writing
"foo".to_string()andString::from("foo")gets tedious after a while.So I'm proposing a
Stringliteral, it could be something as simple ass"foo",@"foo", or evens!"foo"similar tovec![1, 2, 3].Pros:
Stringgets less verbose, and it comes across just as clear.Cons:
Stringgets special treatment