[swift-evolution] [swift-evolution-announce] [Returned for revision] SE-0089: Renaming String.init<T>(_: T)

L. Mihalkovic laurent.mihalkovic at gmail.com
Fri May 27 02:31:47 CDT 2016



> On May 27, 2016, at 8:58 AM, Daniel Vollmer via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On 27 May 2016, at 07:14, Patrick Smith via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> 
>>> On 27 May 2016, at 2:40 PM, Austin Zheng via swift-evolution <swift-evolution at swift.org> wrote:
>>> 
>>> Any of the NSObject subclass candidates may require their `description`s to be altered to meet the semantics, which may or may not be an acceptable breaking change.
>> 
>> Do you think it might be worth changing `description` to be named something else? Something more clear, less likely to conflict with ‘real’ properties — ‘description’ doesn’t seem to portray something that is value-preserving. What is the reason for calling it ‘description’?
> 
> I’m also not quite sure (from the suggested names) whether the intended use is to be “a string *description* that happens to be value-preserving” (for which the name description might be ok), or “a value-preserving version of the instance as string *with no intent of that string ever being descriptive or helpful when presented to anything other than the matching initialiser of the same type*” (which rather be one form of serialisation).
> 
>    Daniel.
> 

If you want to pursue this line of thinking, there is already precedent in the language for denoting 'an equivalent representation to', it is the "as" keyword. So perhaps to denote that the string is an equivalent representation of the value of this object, something like the following might be closer:

asStringValue
asString

but not the following as they convey the notion of a convertion rather than an equivalence:
toString
toStringValue

But frankly, I don't know that is it worth touching description (as the merrit of avoiding the ensuing debate of camel casing).


> _______________________________________________
> 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