[swift-evolution] Standard library 'Data' type pre-proposal

Austin Zheng austinzheng at gmail.com
Wed May 11 10:41:17 CDT 2016


I think hex encoded string conversion is a important use case. Another idea - instead of making the Data type itself generic, there can be a generic Data.View<T : IntegerType> into the data, or the Data type can come with a number of Views for each of the fixed-width integer types.

Austin


> On May 11, 2016, at 7:09 AM, Jeremy Pereira <jeremy.j.pereira at googlemail.com> wrote:
> 
> 
>> On 11 May 2016, at 10:37, Austin Zheng via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> Hello swift-evolution,
>> 
>> 
> 
> ...
> 
>> Some thoughts:
>> 
>> - It's not clear if the methods to convert to and from base-64 encoded data are necessary. The state flag that tries to mark whether or not a Data represents base-64-encoded string stored as a data may be unnecessary as well.
>> 
> 
> I would definitely vote for having the base64 conversions in. The state flag would have less utility IMO. 
> 
> I would also ask that you consider conversions to and from hex encoded strings. If nothing else, it would make it easier to convert git commit hashes to a readable form in my forthcoming git client vapourware.
> 



More information about the swift-evolution mailing list