Swift: String interpolation does not support nested string literals
| Originator: | rix.rob | ||
| Number: | rdar://17411432 | Date Originated: | 22-Jun-2014 12:41 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode6-Beta2 (6A216f) |
| Classification: | UI/Usability | Reproducible: | Always |
Summary:
Currently, you cannot use string literals within string interpolations, making it more difficult to express certain idioms.
Steps to Reproduce:
1. Try to run the following code in a playground or REPL or otherwise:
"[ \(join(" ", [ 1, 2, 3 ])) ]"
Expected Results:
I expected it to be run equivalently to this:
let joined = join(" ", [ 1, 2, 3 ])
"[ \(joined) ]"
Actual Results:
The compiler says “Unexpected '"' character in string interpolation”
Regression:
N/A
Notes:
Balancing/nestable string interpolation is extremely convenient, and syntactically unambiguous. It can get silly—interpolated strings within interpolated strings—but that’s a “it hurts when I do this,” “then don’t do that” issue, in my opinion.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!