[swift-evolution] ASCIIString

Austin Zheng austinzheng at gmail.com
Sun Dec 13 16:04:12 CST 2015


Pragmatically, I would love this. I've run into use cases before where a sequence of ASCII characters would have sufficed, and the additional complexity of the Unicode model is unnecessary and undesired.

On a philosophical level, I think there's a discussion to be had as to whether the language/stdlib is the right place to delineate subsets of Unicode for programmer use, and whether or not having ASCIIString will encourage lazy programmers to avoid Unicode support altogether and/or 'misuse' this type as a means of storing raw bytes. 

Personally, I'm +1 but I think we should carefully consider the ramifications.

Best,
Austin

> On Dec 13, 2015, at 1:47 PM, Jacob Bandes-Storch via swift-evolution <swift-evolution at swift.org> wrote:
> 
> StaticString provides an "isASCII" boolean property, but manipulating strings still requires the use of UnicodeScalarView / CharacterView, even if the strings are statically known to be ASCII-only.
> 
> I think it would be nice to have an ASCIIString in the standard library, similar to StaticString but with the following improvements:
> 
> - ASCIIString itself would be MutableCollectionType, with Index == Int for easy access.
> 
> - Its Generator.Element would be something which works with simple + and - operators (either UInt8, or perhaps a repurposed UnicodeScalar, or a new ASCIIScalar).
> 
> - The ability to create new ASCIIStrings at runtime, by appending/removing bytes, or by concatenating other ASCIIStrings.
> 
> Would anyone else find this useful?
> 
> Jacob Bandes-Storch
>  _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151213/c2049618/attachment.html>


More information about the swift-evolution mailing list