[swift-evolution] [Pitch] Single-quotes for Character literals

Jordan Rose jordan_rose at apple.com
Mon Dec 21 18:50:22 CST 2015


> On Dec 21, 2015, at 15:55 , Tino Heth via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> I suggest reinstating the C convention of using single-quotes for delimiting Characters.
> I rarely use chars, but from a theoretical standpoint, I'm not so happy with the ambiguity as well…
> But one suggestion if you want to make a proposal:
> Char has a fixed length (well, at least that was the case before unicode ;-), so there is no need for a closing delimiter. Leaving the second ' (or whatever might be used) out would save one out of three keystrokes and no one could try to create characters like
> 'this isn't allowed here'

Unicode is incredibly important, as is deciding whether you want to create a Character or UnicodeScalar (or some other type). In practice I don't think either Character or UnicodeScalar is common enough to deserve a special syntax.

Andrew, you said your use case is a compiler? I believe Dmitri and Dave have some ideas for how better to work with text-like structural data (code, markup, JSON, etc), but they're not ready to share yet. Superficially making Character more convenient won't really help with the rest of the issues in this space; a larger model is needed.

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


More information about the swift-evolution mailing list