An argument could be made that the '\' character is used to escape and when you are doing string interpolation/printing you are clearly doing an operation more similar to bash's use of '$' to extract the value of a variable than escaping.
The need to logically separate escaping from parameter value extraction/string interpolation is IMHO grounds for this change alone. Sent from my iPhone > On 21 Jun 2016, at 23:35, Haravikk via swift-evolution > <swift-evolution@swift.org> wrote: > > >>> On 21 Jun 2016, at 22:49, Gwynne Raskind via swift-evolution >>> <swift-evolution@swift.org> wrote: >>> >>> On Jun 21, 2016, at 15:48, Jonathan Cotton via swift-evolution >>> <swift-evolution@swift.org> wrote: >>> >>> I'd support $() as is in use by other languages, including Kotlin, as >>> mentioned it seems less disruptive and more inline with the tokenised >>> parameters that are already supported in closures. >>> >>>> On 21 Jun 2016, at 21:43, Kenny Wyland via swift-evolution >>>> <swift-evolution@swift.org> wrote: >>>> >>>> Hi all, >>>> >>>> I'm new to the list and I just searched through the archives as best I >>>> could to see if someone else had already brought this up, but I didn't >>>> find anything. Forgive me if this horse has been beaten. >>>> >>>> I find that typing \(var) is very disruptive to my typing flow. The more I >>>> code in Swift, the more I like it, but every time I'm coding and then have >>>> to hiccup while typing \ then ( causes me to be annoyed. I know, it's >>>> minor, but it isn't a key combination that flows quickly. >>>> >>>> I would much rather have $() or perhaps ${} (like Groovy lang) or perhaps >>>> @() to go along with other uses of @ throughout the language. >>>> >>>> A shifted key, like $ or @, followed by another shifted key like (, allows >>>> for a much faster flow and they are much closer to the home keys than \ >>>> which is nearly as far from home keys as possible (and awkward). >>>> >>>> Thoughts? >>>> >>>> Kenny Wyland >>>> InADayDevelopment.com >> >> I have to disagree - The \ syntax is consistent with other string escape >> sequences (\n etc.) and reads naturally to me in that regard. Additionally, >> the \ is very visually distinctive in a string, much moreso than the >> "traditional" $ variable marker. Almost every language I’ve seen using $ for >> interpolation in strings is doing so because it also uses it as a variable >> prefix in non-string contexts. To top it off, using $ instead would, for me, >> just add yet another language for which I have to remember "does the $ go >> inside or outside the name delimiter braces/brackets/whatever?", "is it >> parenthesis, braces, brackets, or some other delimiter for variable names?", >> "what kind of expressions can I use in this context?", "can I use >> interpolation without any delimiters for simple cases?", etc. See also PHP, >> Perl, ten flavors of shell scripts, JavaScript, JSP/ASP, XPath, and so >> forth. The \() syntax is unique to Swift and therefore very easy to remember. > > I agree with this; Swift’s only other dollar sign use is for closure > shorthand variables, which is technically a non-string context but I assume > you mean on *all* variables. Anyway, I think \() is actually a good way to do > this, as it’s unambiguous, and not something you’re likely to type by > mistake, since you don’t need to escape the brackets for any other purpose. > The way I think of it is as an escape from the string, which is IMO more > logical than a variable inside a string which dollar notation brings to mind > (for me at least). > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution