News for hackers. Stuff that matters.
Re:[WTF] Go Unicode Hack to Get Pseudo-Generics by derefr on Friday May 05, 2017 @07:23PM (#14277562)
Unicode code comments make obvious sense if the software company is e.g. Chinese.

And allowing Unicode characters inside string literals makes obvious sense as well. It lets you have string literals which are, well, literal, rather than full of escape codes.

Unicode identifiers can make some sense for the same reason that comments do; often you'll want to just name something after some un-translatable concept from your own language, but even if you "romanize" the word, it might still require accents—making it Unicode!—to be that word, instead of some other word. (Pinyin and ASCII-/\w+/ do not get along.)

---

Separately, the devil's advocate position: Unicode identifiers for function names or operators are just plain fun, if your keyboard lets you write them easily. I'm surprised there's no modern equivalent of APL created to take advantage of the symbols you can write easily in macOS using Alt, Alt+Shift, or Ctrl+Cmd+Space.

(I once designed a Markdown variant that used these characters instead of ASCII ones. It also expected the use of IME-inserted smart quotes in the text, and compiled the opening ones to <q> and the closing ones to </q>.)

Re:[WTF] Go Unicode Hack to Get Pseudo-Generics by Iv on Saturday May 06, 2017 @12:37AM (#14278694)
Comments and strings, yes. And even though, non-english comments is considered bad practice at the non-english-but-international company I currently work for.

In identifiers? No way in hell. ASCII is small and well known and yet has its share of subtleties between \r \n \t and whitespaces and case-sensitiveness.

The main point of ASCII is that it is really, totally, viewable without any surprise. Most programming fonts will be unambiguous, and won't make one letter appear like another: oO0, iIlL|1

Also, you can make monospace fonts for ASCII. One character can occupy a predictable space on screen.

Unicode is another level totally. Not only do tons of glyphs look similar but also some of them are hidden, some of them reverse the order of the flow (LTR) some modify others, some (like emojis) are supposed to not be easily colorable. And of course, d̕ia̻̟̮c̨̤͚ri͍͕̪t̘̫̺͎̰̘i̯̫̱̻c̵͔̙̮̻̫͕̝s͉̹ make character expand up and down (I only went smoothly on this one, use http://www.marlborotech.com/Zalgo.html to realize the magnitude of this mess)

I once had to deal with a program written in Japanese, luckily in UTF-8. I was very tempted to propose patches using accentuated French and emojis.

I'll be a proud defender of my beautiful French language any day, but as a programmer, we have the incredible luck of having more or less standardized on a language and a simple encoding. We should see that as an asset, not as a limitation.

Imagine if Linus commented his code in Finnish. We can't have that.

Re:[WTF] Go Unicode Hack to Get Pseudo-Generics by ptman on Saturday May 06, 2017 @01:59AM (#14278943)
I imagine he would've commented in Swedish, not Finnish
Re:[WTF] Go Unicode Hack to Get Pseudo-Generics by tjalfi on Saturday May 06, 2017 @02:14AM (#14278989)
APL.Swift[0] is a Swift 1 library that adds APL operators. It probably wouldn't be that hard to port it to Swift 3.

[0] https://github.com/CodaFi/APL.swift/blob/master/APL/Operator...

Re:[WTF] Go Unicode Hack to Get Pseudo-Generics by digi_owl on Friday May 05, 2017 @08:49PM (#14277985)
I seem to recall reading an email regarding the policy of only using English words for Linux kernel variables etc. Something about avoiding having to deal with stuff that looked like street signs from ryleh.
Re:[WTF] Go Unicode Hack to Get Pseudo-Generics by majewsky on Saturday May 06, 2017 @08:27PM (#14283126)
So "I" and "a" are okay, but "n" isn't? :)