Skip to content

Commit 8ed9a11

Browse files
committed
Extend discussion of future work for dotted.paths
Some discussion in the RFC about how `dotted.paths` might be supported, especially in formatting parameters, came to the conclusion that a new syntax would very likely be desirable. This is added to the future work section and nominally suggests the {(expr)} interpolation syntax to achieve this.
1 parent 2d44315 commit 8ed9a11

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

text/0000-format-args-implicit-identifiers.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,14 @@ It is not clear how significant a change this might require to `format_args!`'s
331331
# Future possibilities
332332
[future-possibilities]: #future-possibilities
333333

334-
The main alternative raised by this RFC is interpolation, which is a superset of the functionality offered by implicit named arguments.
334+
The main alternative raised by this RFC is interpolation, which is a superset of the functionality offered by implicit named arguments. However, for reasons discussed above, interpolation is not the objective of this RFC.
335335

336336
Accepting the addition of implicit named arguments now is not incompatible with adding interpolation at a later date.
337337

338-
In particular the RFC author expects that more than once in the future he'll be frustrated that formatting macro invocations which involve field access will require significantly more typing than invocations receiving implicit named arguments!
338+
Future discussion on this topic may also focus on adding interpolation for just a subset of possible expressions, for example `dotted.paths`. We noted in debate for this RFC that particularly for formatting parameters the existing dollar syntax appears problematic for both parsing and reading, for example `{self.x:self.width$.self.precision$}`.
339339

340-
However, for reasons discussed above, interpolation is not the objective of this RFC.
340+
The conclusion we came to in the RFC discussion is that adding even just interpolations for `dotted.paths` will therefore want a new syntax, which we nominally chose as the `{(expr)}` syntax already suggested in the [interpolation](#interpolation) alternative section of this RFC.
341+
342+
Using this parentheses syntax, for example, we might one day accept `{(self.x):(self.width).(self.precision)}` to support `dotted.paths` and a few other simple expressions. The choice of whether to support an expanded subset, support interpolation of all expressions, or not to add any further complexity to this macro is deferred to the future.
343+
344+
A future proposal for extending interpolation support might wish to explore alternative syntaxes to `{(expr)}` parentheses which can also be parsed and read comfortably.

0 commit comments

Comments
 (0)