[swift-evolution] [Review] SE-0089: Renaming String.init<T>(_: T)

L. Mihalkovic laurent.mihalkovic at gmail.com
Sat May 21 02:39:40 CDT 2016



> On May 20, 2016, at 7:44 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> on Fri May 20 2016, plx <swift-evolution at swift.org> wrote:
> 
>>> On May 19, 2016, at 5:57 PM, Dave Abrahams via swift-evolution
>>> <swift-evolution at swift.org> wrote:
>>> 
>>> 
>>> on Tue May 17 2016, Chris Lattner
>> 
>>> <swift-evolution at swift.org
>>> <mailto:swift-evolution at swift.org>>
>>> wrote:
>>> 
>>>> Hello Swift community,
>>>> 
>>>> The review of "SE-0089: Renaming String.init<T>(_: T)" begins now and
>>>> runs through May 23. The proposal is available here:
>>>> 
>>>>    https://github.com/apple/swift-evolution/blob/master/proposals/0089-rename-string-reflection-init.md
>>>> 
>>>> Reviews are an important part of the Swift evolution process. All
>>>> reviews should be sent to the swift-evolution mailing list at
>>>> 
>>>>    https://lists.swift.org/mailman/listinfo/swift-evolution
>>>> 
>>>> or, if you would like to keep your feedback private, directly to the review manager.
>>>> 
>>>> What goes into a review?
>>>> 
>>>> The goal of the review process is to improve the proposal under review
>>>> through constructive criticism and contribute to the direction of
>>>> Swift. When writing your review, here are some questions you might
>>>> want to answer in your review:
>>>> 
>>>>    * What is your evaluation of the proposal?
>>>>    * Is the problem being addressed significant enough to warrant a change to Swift?
>>>>    * Does this proposal fit well with the feel and direction of Swift?
>>>>    * If you have used other languages or libraries with a similar
>>>> feature, how do you feel that this proposal compares to those?
>>>>    * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
>>>> 
>>>> More information about the Swift evolution process is available at
>>>> 
>>>>    https://github.com/apple/swift-evolution/blob/master/process.md
>>> 
>>> 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`.
>> 

Considering this idea that swift is concerned with speed, and efficiency, and symetry... this is the LAST thing I would ever expect to happen... you're going to tell us that is does't matter because the compiler is going to parse the string and then realise that this is not a real printf type of interpolation, but is simple convertion?!
Well then lets do it, but in the name of that symetry and economy and efficiency that justifies this one, lets make sure that Int and Float and Double convertions go the same route, right?


>> Is there some performance-driven motivation here, or is this just aesthetics?
>> 
>> I ask b/c not having a name for this "initializer" here would seem
>> mildly annoying and asymmetric vis-a-vis `String.init(reflecting:)`;
>> sure, I can always add an equivalent with a name, but I’m curious if
>> there’s an argument-from-functionality for the removal.
> 
> It's mostly aesthetics and minimizing redundant API surface area.  We
> don't love any of the proposed labels for this usage and feel this API
> should be substantially lighter-weight than the `reflecting:` one.  We
> could always go back to providing the global toString() function we once
> had, but we don't feel that's a great answer either.  Since there's
> already another way to do this, we think it's better to remove the API
> than reshape it in an unsatisfying way.

I am quite shocked that forcing people to rhink about interpolation can be seen as a more intuitive, more 'swift' soluttion than even a plain-obvious toString()...


> 
>> Also FWIW I like the idea to use `init(describing:)`, although it’s
>> still a bit quirky when put side-by-side with `init(reflecting:)`
>> (since it doesn’t really capture the heart of the distinction between
>> the two, IMHO).
>> 
>>> 
>>> Thanks,
>>> 
>>> -- 
>>> -Dave
>>> 
>>> _______________________________________________
>>> swift-evolution mailing list
>>> swift-evolution at swift.org
>>> <mailto:swift-evolution at swift.org>
>>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> -- 
> -Dave
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list