Proposal: Make it easier to use unicode identifiers in Swift.


(Rainer Brockerhoff) #1

I may be mistaken, but IMHO the main benefit of unicode identifiers is
to allow non-anglophone programmers to name things in their native
language, with accents and diacritics and so forth.

For those programmers, typing such identifiers is already easy, as those
characters will be on their local keyboard layout or input method.

Developers doing a lot of math work should have some such mechanism
already in place - keyboard macros come to mind - since they'd also have
to type all that into the docs.

As for making it easier to use obscure characters/emojis in identifiers,
I'm in favor of making that rather difficult :slight_smile:

···

On 1/15/16 23:46, swift-evolution-request@swift.org wrote:

Date: Fri, 15 Jan 2016 18:39:14 -0500
From: Amir Michail <a.michail@me.com>
To: Jordan Rose <jordan_rose@apple.com>
Message-ID: <2D94F6ED-CA12-4C2D-94A8-5A38149DE863@me.com>

On Jan 15, 2016, at 6:37 PM, Jordan Rose <jordan_rose@apple.com> wrote:

Hi, Amir. What benefit does this feature have for a Swift programmer? In my mind, it makes it harder to reason about what something does, because there may now be multiple names for the same variable.

Jordan

What’s the point of supporting unicode characters in identifiers if almost all of them are too hard to type?

With this approach, you can use standard text to type them and have them converted to unicode every once in a while (e.g., on a commit).

--
Rainer Brockerhoff <rainer@brockerhoff.net>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
In their own business even sages err."
http://brockerhoff.net/blog/