3 ms·
This kind of feels like, "so we put a huge ice cube in the ocean and finally solved global warming." Isn't it just yet another syntax for strings with another
by Waterluvian 8y ago
This kind of feels like, "so we put a huge ice cube in the ocean and finally solved global warming."
Isn't it just yet another syntax for strings with another set of rules? What happens when my string includes """# ? Why not just make """ behave this new way and have one less type of string literal?
Why can't the solution be, "put the ASCII in a file to be read in." ?
- dangerbird2 8y agoChanging the behavior of """ would cause compatability issues, especially considering it's not unreasonable to want a multiline string that employs escape codes. There are plenty of cases where you want a large string literal embedded in the binary as opposed to reading a file at runtime (hard-coded OpenGL shaders are one case I can think of).
- dbaupp 8y ago""" can't behave like this, because it won't be able to include """ itself in the string. The """# case is handled by using more #s: ##""" in string """# still in string """## // out of string Swift has two types of string "..." and """...""", either of which can have zero-or-more # at the start and end.