[swift-evolution] Allow ' in variable/constant names?

Jay Abbott jay at abbott.me.uk
Thu Jan 12 11:57:20 CST 2017


Georgios - the problem with that character is that it's an apostrophe in
Unicode, not a single-quote. It was originally overloaded as both in ASCII
though hence commonly used as either, especially in programming languages.
I'm definitely with Ted Clancy on this one:
https://tedclancy.wordpress.com/2015/06/03/which-unicode-character-should-represent-the-english-apostrophe-and-why-the-unicode-committee-is-very-wrong/

I generally don't care what characters my editor/email client/browser/etc.
use when I type ' on the keyboard, because a human reader will understand
it, so I just do the quickest/easiest thing. But when I'm writing a TeX
document I take care to use an apostrophe where needed and left/right
single quotation marks where needed. And for coding I'd like to be precise,
specific, unambiguous, and technically correct, so either single or double
quotation marks (or ‹ and ›) would be acceptable for character literals. If
compiler can cope with double quotes for both string and character literals
in an unambiguous way then that's fine too.

On Thu, 12 Jan 2017 at 14:35 Georgios Moschovitis <
george.moschovitis at icloud.com> wrote:

> So yeah, solution is to make characters easier to type, not modify the
> language.
>
>
> +1
>
> If like me you don't have such a keyboard, you can always use ctrl+⌘+
> <space> and type ‘PRIME’ to find it, then pick it from recently
> used/favourites.
>
> Regarding the other point, I agree that character literals would be handy,
> but again I’m not sure if apostrophe is the right character to indicate it.
> Although it is familiar, perhaps LEFT SINGLE QUOTATION MARK and RIGHT
> SINGLE QUOTATION MARK would be better, they can be relatively easily typed
> with ⎇+] and ⎇+⇧+] respectively. Xcode could also convert two apostrophes
> into ‘’ for you and your fingers would quickly learn to type ' ' ← ‹char›.
>
> I think the single (ASCII) quote is standard enough for use as a character
> delimiter.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170112/35e22e99/attachment-0001.html>


More information about the swift-evolution mailing list