<div dir="ltr">On Sun, Jul 24, 2016 at 7:09 PM, Dave Abrahams <span dir="ltr"><<a href="mailto:dabrahams@apple.com" target="_blank">dabrahams@apple.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
on Sun Jul 24 2016, Saagar Jha <saagarjha28-AT-gmail.com> wrote:<br>
<br>
> Ahh…I agree in that case; something like `utf8Array` might be a better<br>
> choice.<br>
<br>
</span> Array(s.utf8)<br>
<br>
seems expressive enough to me, if what you really want is an array. IMO<br>
we should consider dropping other spellings.<br></blockquote><div><br></div><div>One reason why `nullTerminatedUTF8` is a pretty good name, IMO: Array(s.utf8) is exactly one element short of Array(s.nullTeminatedUTF8), that being the null terminator. Incidentally, Array(s.utf8) is actually a little problematic, afaict, as its inferred type is Array<_Element>, whatever that is. Array<UTF8.CodeUnit>(s.utf8) works though.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> Saagar Jha<br>
><br>
>> On Jul 24, 2016, at 16:44, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com">xiaodi.wu@gmail.com</a>> wrote:<br>
>><br>
</span><span class="">>> On Sun, Jul 24, 2016 at 6:42 PM, Saagar Jha <<a href="mailto:saagarjha28@gmail.com">saagarjha28@gmail.com</a> <mailto:<a href="mailto:saagarjha28@gmail.com">saagarjha28@gmail.com</a>>> wrote:<br>
>> Well, yes, but hardly anyone calls it a “char array” unless they’re<br>
>> trying to emphasize the fact that it’s not being used as a String.<br>
>><br>
>> I was woefully unclear with that last email. IMO, `utf8CString` is<br>
>> fine, since a CString really is a null-terminated array of<br>
>> CChars. But `utf8String` implies that the property is a String,<br>
>> which `nulTerminatedUTF8` is not (it's a<br>
>> `ContiguousArray<UTF8.CodeUnit>`).<br>
>><br>
>> Saagar Jha<br>
>><br>
>><br>
>><br>
>>> On Jul 24, 2016, at 15:58, Xiaodi Wu via swift-evolution<br>
</span>>>> <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a> <mailto:<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>>><br>
<span class="">>>> wrote:<br>
>>><br>
>>> On Sun, Jul 24, 2016 at 5:34 PM, Erica Sadun via swift-evolution<br>
</span>>>> <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a> <mailto:<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>>><br>
<span class="">>>> wrote:<br>
>>><br>
>>> > On Jul 24, 2016, at 3:45 PM, Dave Abrahams via swift-evolution<br>
</span>>>> > <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a> <mailto:<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>>><br>
<span class="">>>> > wrote:<br>
>>> ><br>
>>> > Xiaodi Wu via swift-evolution <swift-evolution@...> writes:<br>
>>> ><br>
>>> ><br>
>>> >> In `String`, the methods `nulTerminatedUTF8` and<br>
>>> >> nulTerminatedUTF8CString` have the word "null" misspelled<br>
>>> ><br>
>>> > Whoa. Isn't "Cstring" redundant with "null-terminated?"<br>
>>><br>
>>> One would hope so. A series of characters terminated by a zero byte.<br>
>>><br>
>>> /// A contiguously stored null-terminated UTF-8 representation of<br>
>>> /// the string.<br>
>>> ///<br>
>>> /// This is a variation on nulTerminatedUTF8 that creates an array<br>
>>> /// of element type CChar for use with CString API's.<br>
>>><br>
>>> I think utf8String and utf8CString capture both meanings. I know they're<br>
>>> a little redundant but they get the meaning across, use CString term of<br>
>>> art, and are pithy compared to any alternatives (like "representation", etc)<br>
>>><br>
>>> They're arrays though, not strings.<br>
>>><br>
>>> -- E<br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> swift-evolution mailing list<br>
</span>>>> <a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a> <mailto:<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>><br>
>>> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a> <<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a>><br>
>>><br>
>>> _______________________________________________<br>
>>> swift-evolution mailing list<br>
>>> <a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a> <mailto:<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>><br>
>>> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a> <<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a>><br>
>><br>
</blockquote></div><br></div></div>