> So in a way you can think of \() as being a means of escaping from the string 
> entirely. I find this more logical than the idea which other languages 
> encourage which is that the variable is somehow embedded inside the string, 
> which is why I actually really like having escape do this in Swift.

I guess it is only a matter of personal preference... I do find the opposite to 
hold true, I like to think about the variable and its expansion so to speak in 
the target string.

Sent from my iPhone

> On 22 Jun 2016, at 11:19, Haravikk <swift-evolut...@haravikk.me> wrote:
> 
> 
>> On 22 Jun 2016, at 09:39, Goffredo Marocchi via swift-evolution 
>> <swift-evolution@swift.org> wrote:
>> 
>> Sorry, but can you explain why the character used to   escape   strings is 
>> also the best choice to do   Variable value extraction/String interpolation? 
>>  They are two different concepts.
> 
> The following two lines are equivalent:
> 
>       return "Value of foo is \(foo), have a nice day!"
>       return "Value of foo is " + foo + "have a nice day!" // Assuming foo is 
> a String already
> 
> So in a way you can think of \() as being a means of escaping from the string 
> entirely. I find this more logical than the idea which other languages 
> encourage which is that the variable is somehow embedded inside the string, 
> which is why I actually really like having escape do this in Swift.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to