On Thu, May 19, 2016 at 6:00 PM, Brent Royal-Gordon via
swift-evolution <[email protected]> wrote:
>> I'm posting this on behalf of Dmitri Gribenko, and Max Moiseev, and
>> myself.
>>
>> We would like to accept the proposal with one modification: rather than
>> add an argument label, we'd like to drop the String initializer
>> altogether, making `"\(expression)"` the standard way to get a string
>> representation of `expression`.
>
> Given how complicated the StringInterpolationConvertible protocol is, I'm not 
> sure it's a good idea to invoke all of that machinery merely to convert an 
> expression to a string. I mean, you end up with code like:
>
>         String(stringInterpolation:
>                 String(stringInterpolationSegment: ""),
>                 String(stringInterpolationSegment: expression),
>                 String(stringInterpolationSegment: "")
>         )
>
> That seems like a lot of code to generate for such a simple task.
>
> (And you can have those empty segments over my dead body—they're very 
> important to a lot of interpolation use cases, because they allow you to 
> distinguish between the literal and interpolated segments. If you want to 
> design a different mechanism that's more efficient and equally capable, well, 
> I'm happy to talk about improving StringInterpolationConvertible any time you 
> are, but it'll definitely be opening a can of worms.)

We will add a special case in the optimizer to fold these empty
segments when interpolation is invoked on String.  It won't affect
other types.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to