Substitution in strings #55
Labels
D-discussion
A decision (D) has not been made yet and is open to discussion
I-feature
This issue (I) regards a (potential) feature in the project
T-accepted
Triage (T): Initial review accepted issue/PR as valid
Short Description:
Enable substitution within string literals.
Motivation:
Substitution within the contents of string literals fits well with the overall functionality of
duplicate
.E.g. it could be used to change the wording on some strings depending on the duplicate.
Additionally, it enables the substitution of documentation comments. Currently, to do so can only be done using the doc attribute and substituting the whole string. Not being able to substitute in docs means our examples of generating different versions of functions for e.g. mutability or async don't work well if you need the documentation to be changed too. See #54. Enabling substitution within strings should (hopefully, needs more investigation) enable substitution within
///
comments directly.Lastly, it's not immediately intuitive that substitution wouldn't work within string literals, making it a pain point for users.
Design
During substition, if a string literal is encountered, run the substitutions within it too.
To parse the contents of strings, the litrs crate can be used. See also this stackoverflow answer.
Misc:
Open questions:
&str
and notTokenStream
(if usinglittrs
), meaning the normal method of identifying substitution identifiers wouldn't work. This is especially difficult with parametric substitution.The text was updated successfully, but these errors were encountered: