You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: text/0000-format-args-implicit-identifiers.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ This would result in downstream macros based on `format_args!` to accept implici
18
18
// implicit named arguments `species` and `name`
19
19
format!("The {species}'s name is {name}.");
20
20
21
-
(Downstream macros based on `format_args!`includes but is not limited to `format!`, `print!`, `write!`, `panic!`, and macros in the `log` crate.)
21
+
(Downstream macros based on `format_args!`include but are not limited to `format!`, `print!`, `write!`, `panic!`, and macros in the `log` crate.)
22
22
23
23
24
24
# Motivation
@@ -185,7 +185,7 @@ For example, Python 3's `.format()` method is on the surface extremely similar t
185
185
"hello {}".format(person)
186
186
"hello {person}".format(person=person)
187
187
188
-
However, Python 3 cannot improve the ergonomics of these functions in the same way that this RFC proposes to use implicit named arguments. This is for technical reasons: Python simply does not have a language mechanism which could be used to add implicit named arguments to the `.format()` method. As a result, offering improved ergonomics in Python would neccesitate the introduction of a language-level interpolation syntax.
188
+
However, Python 3 cannot improve the ergonomics of these functions in the same way that this RFC proposes to use implicit named arguments. This is for technical reasons: Python simply does not have a language mechanism which could be used to add implicit named arguments to the `.format()` method. As a result, offering improved ergonomics in Python necessitated the introduction of a language-level interpolation syntax (f-strings, described in the [prior art](#prior-art) section).
189
189
190
190
(Note, the closest Python 3's `.format()` can get to implicit named arguments is this:
191
191
@@ -257,8 +257,8 @@ The following code would be the equivalent way to produce a new string combining
257
257
258
258
// Scala
259
259
s"$greeting $person"
260
-
261
-
// PHP
260
+
261
+
// Perl and PHP
262
262
"$greeting $person"
263
263
264
264
It is the RFC author's experience that these interpolating mechanisms read easily from left-to-right and it is clear where each variable is being substituted into the format string.
@@ -272,7 +272,7 @@ Implementing implicit named arguments in the fashion suggested in this RFC would
272
272
273
273
It should be noted, however, that other languages' string interpolation mechanisms allow substitution of a wide variety of expressions beyond the simple identifier case that this RFC is focussed on.
274
274
275
-
Please see the discusison on [interpolation](#interpolation) as an alternative to this RFC.
275
+
Please see the discussion on [interpolation](#interpolation) as an alternative to this RFC.
0 commit comments