News for hackers. Stuff that matters.
Re:Programming languages have to break free from the tyranny... by jerf on Saturday October 30, 2010 @12:00PM (#1851097)
How do I type it?

How do I type it?

How do I type it?

That's the fundamental question worth repeating three times. Numerous languages support Unicode in the syntax and it doesn't matter because nobody can use them because who wants to use a language where the 'or' operator is a textual copy and paste operation for a new user?

You can incrementally stuff more symbols onto a keyboard but I'd want to see some science that shows that people are able and willing to deal with a keyboard that contains a their local language, a full suite of mathematical symbols including Greek, Hebrew, and the various mangled Latin characters that mathematics uses, plus logic, set notation, plus the useful not-necessarily-mathematical operators that language designers either want or in some cases already use/permit such as arrows, boxes, and all the other things. And we still need our full editor keyboard shortcuts and if you're a power user (and we're talking programmers...) our keyboard shortcuts for the window manager.

So, you want to predicate learning your language on me learning all that? I'm the kind of fruitcake that learned Haskell but I still laugh at the idea of learning something like that. No sale. (And I don't use the Unicode Haskell permits because while I'm actually very comfortable remapping my own keyboard, for instance I actually have interrobang bound to a key because I found myself using it so much, why would I do that to anybody else who ever tries to read or use my code‽)

Re:Programming languages have to break free from the tyranny... by bokchoi on Saturday October 30, 2010 @01:16PM (#1851290)
Fortress strikes a mostly practical middle ground. It uses an ASCII representation that can be translated into glyphs:

http://projectfortress.sun.com/Projects/Community/wiki/MathS... http://projectfortress.sun.com/Projects/Community/wiki/Fortr...

Re:Programming languages have to break free from the tyranny... by jcromartie on Saturday October 30, 2010 @04:43PM (#1851768)
That's actually really nice. There's no reason an editor couldn't just do it behind the scenes, like how Emacs' org-mode handles dates and links in a plain text file.
Re:Programming languages have to break free from the tyranny... by pjscott on Saturday October 30, 2010 @04:56PM (#1851794)
It can also do ASCII art spreadsheets. Org mode is ridiculous, and I love it.
Re:Programming languages have to break free from the tyranny... by lisper on Saturday October 30, 2010 @12:06PM (#1851116)
Like this: (λ (ø) (sin (* π ø)))

I did that on a Mac using the option key and a few custom key bindings.

The real question is how do you READ it. The problem is that unless you are very selective about your fonts and which characters you use, it can become impossible to read because many unicode characters are visually indistinguishable.

Re:Programming languages have to break free from the tyranny... by jerf on Saturday October 30, 2010 @02:15PM (#1851431)
With all due respect, I fairly clearly indicated that I am aware of such things. I even typed a unicode character that for me is one keystroke: ‽. I've got that mapped to backspace, since I moved that to Caps Lock (and just discarded Caps Lock).

But that's not the actual point. Learning a new language is a challenge. Learning a new language when you haven't already learned 10 is an even bigger challenge. Learning your first language is very difficult, which most of us have probably forgotten. Now, to the list of things you have to learn to do so, we want to add learning several dozen brand new keystrokes that nobody knows offhand? It may not seem like much compared to everything else one has to learn to program, but having to learn a lot of stuff is annoying; having to fight your input devices is like being rendered mute. Try switching your keyboard map for a few days to see how you like it. This is not a level of frustration worth pursuing.

Re:Programming languages have to break free from the tyranny... by mustpax on Saturday October 30, 2010 @03:31PM (#1851601)
Somewhat offtopic: what do you use to remap keys? I've long wanted to customize my layout.
Re:Programming languages have to break free from the tyranny... by klochner on Saturday October 30, 2010 @04:21PM (#1851716)
PCKeyboardHack for mac (i have caps mapped to esc for vi)

http://pqrs.org/macosx/keyremap4macbook/extra.html

Re:Programming languages have to break free from the tyranny... by driax on Saturday October 30, 2010 @03:37PM (#1851610)
On window I use Autohotkey. Remapping Capslock to F-15 (so that I can customize that button differently in each program) is a simple script:

    Capslock::F15
Re:Programming languages have to break free from the tyranny... by zzleeper on Saturday October 30, 2010 @04:39PM (#1851759)
Can you elaborate on the F15 thing? According to google, it's just the mute button!
Re:Programming languages have to break free from the tyranny... by jcromartie on Saturday October 30, 2010 @04:41PM (#1851761)
Yeah yeah yeah... every l33t Mac hax0r knows how to use the option key. Great! But guess what? People program on Linux and Windows too, and the fact is that it's a hell of a lot easier to type "fn" than it is to type ∑Ò™£‹˙√«»ç◊... where the hell is the key for lambda?
Re:Programming languages have to break free from the tyranny... by sblom on Saturday October 30, 2010 @06:37PM (#1851961)
And that sigma that you led off with is the mathematical summation sigma and not the Greek letter. This gets really really hard cross-platform. (On Windows, your best bet for typing summation sigma requires a registry hack.)
Re:Programming languages have to break free from the tyranny... by pbhjpbhj on Saturday October 30, 2010 @08:10PM (#1852117)
>the mathematical summation sigma and not the Greek letter

I'm prepared to be corrected but ..

Greek capital sigma is the mathematical "sum" symbol just as capital pi is the product symbol.

Re:Programming languages have to break free from the tyranny... by james2vegas on Sunday October 31, 2010 @08:12AM (#1853139)
While they are the same, in Unicode, the codepoint U+2211 is summation, U+03A3 is capital letter sigma.
Re:Programming languages have to break free from the tyranny... by Raphael on Saturday October 30, 2010 @04:32PM (#1851741)
Surely you mean θ as in theta.
Re:Programming languages have to break free from the tyranny... by LInuxFedora on Saturday October 30, 2010 @12:36PM (#1851194)
C'mon they are distinguishable. can you differentiate between λ and ø .
Re:Programming languages have to break free from the tyranny... by nuclear_eclipse on Saturday October 30, 2010 @01:16PM (#1851288)
But can you quickly and easily distinguish between Ͱ and ͱ, or even Ω and Ω? The last two really are different Unicode characters, the first is Greek capital Omega, the second is the Ohm symbol...
Re:Programming languages have to break free from the tyranny... by WalterBright on Saturday October 30, 2010 @03:19PM (#1851571)
And the first two are rendered in my browser as a square box because the font doesn't support them. Useless.
Re:Programming languages have to break free from the tyranny... by sprout on Saturday October 30, 2010 @06:51PM (#1851989)
Mobile webkit?
Re:Programming languages have to break free from the tyranny... by bmm6o on Saturday October 30, 2010 @07:33PM (#1852048)
Firefox on Vista renders as boxes.
Re:Programming languages have to break free from the tyranny... by wmf on Saturday October 30, 2010 @03:00PM (#1851527)
I see why that's a problem for domain names, but not for programming languages. You just define that one character has meaning and all its homoglyphs are syntax errors (even in identifier names).
Re:Programming languages have to break free from the tyranny... by akgerber on Saturday October 30, 2010 @03:56PM (#1851660)
But what characters are homoglyphs are determined by your choice of typeface.
Re:Programming languages have to break free from the tyranny... by jacobbijani on Saturday October 30, 2010 @03:40PM (#1851617)
Introduce a library or something written by someone else that tries to use clever and cute Unicode names, and imagine debugging that.
Re:Programming languages have to break free from the tyranny... by dedward on Saturday October 30, 2010 @04:48PM (#1851777)
Which is kind of weird, considering that the Ohm symbol is by definition the greek Omega - why did we use two separate unicode slots for them?
Re:Programming languages have to break free from the tyranny... by billswift on Saturday October 30, 2010 @08:34PM (#1852151)
I suspect they incorporated two different pre-existing symbol sets - the Greek alphabet and a set of scientific symbols.

Added - they did; here is an older version (3.0) of the standard online http://www.unicode.org/book/u2.html

Re:Programming languages have to break free from the tyranny... by ciupicri on Saturday October 30, 2010 @01:30PM (#1851321)
Do you have any idea why there are 2 different Unicode characters when on paper you would use the Greek Omega letter?
Re:Programming languages have to break free from the tyranny... by Hemospectrum on Saturday October 30, 2010 @01:47PM (#1851370)
Unicode is a superset of numerous other encodings, usually the national standards of the countries whose written languages they want to encode. For example, the sections for the Greek and Cyrillic alphabets have identical layouts to existing Greek-only and Russian-only encodings.

The exceptions to this policy are usually writing systems that didn't have standardized encodings at the time they were incorporated into Unicode. Also, the rather notorious CJK unification project resulted in several new overlapping layouts as Unicode policy changed over time with respect to Chinese characters.

Re:Programming languages have to break free from the tyranny... by mfukar on Saturday October 30, 2010 @01:29PM (#1851316)
That's another very interesting difficulty: the symbol for ohm is supposed to be the Greek capital omega. Resolving such ambiguities (where applicable, of course) would probably add a lot of complicated code, and I'm not 100% sure it's trivial for all similar cases.
Re:Programming languages have to break free from the tyranny... by kiujhgbnj on Saturday October 30, 2010 @01:16PM (#1851289)
But can you distinguish between a capital Beta and a Shluse?
Re:Programming languages have to break free from the tyranny... by llimllib on Saturday October 30, 2010 @01:40PM (#1851346)
Just for reference in your screen font: β and ß
Re:Programming languages have to break free from the tyranny... by Seth_Kriticos on Saturday October 30, 2010 @12:58PM (#1851245)
I absolutely agree! There are about 104/5 keys on a keyboard, and the most accessible are within the alphanumeric range, around 48 + the main control keys. This is basically the effective writing area, with a core areas of the baseline and the alphabetic rows. Even the general ASCII characters are hard to fit in that, let alone the unicode palette.

Another reason this makes no sense is, that programming languages are actually little about syntax and much about paradigms (proc, func, oop, etc.) with technical details, like garbage collection and runtime features like interpretation. That's the important part, not the character set.

Yes, I'm one of the geeks that use Dvorak, vim and just got me a mechanical keyboard with tactile feedback. I care a lot about my typing, and I sure as hell don't want to type in unicode.

Really, I actually live in Germany, and have the extra 3 umlauts on my secondary layout, and that's already a royal pain in the ass. I also did some CJK text input (Japanese is a hobby of mine). well, don't get me started.

No, more than the ASCII character set is defiantly the very last thing you might want, eclipsed only by syntax highlighted critical path display. He could at least have taken the time to imagine what the result of that would have been, or make a mockup, then he would not post this crap!

Re:Programming languages have to break free from the tyranny... by contextfree on Saturday October 30, 2010 @01:27PM (#1851310)
Well yeah, maybe syntax isn't the most important thing, but for the question of which character set is better for syntax, syntax is important. That's like saying that we shouldn't be discussing programming languages at all because preventing nuclear war/ecological catastrophe/whatever is more important. I would also argue that syntax is important for the clarity and usability of those semantic and runtime/performance characteristics (as programming languages may somehow help in alleviating, or exacerbating, those bigger problems ...)
Re:Programming languages have to break free from the tyranny... by derefr on Saturday October 30, 2010 @08:15PM (#1852125)
I type it with a custom iPad app that acts like a wireless keyboard (over wi-fi). ASCII is at the top (and of that's all you need, fine); however, if you swipe up, the board scrolls to reveal (and snap to) another full pane of keys. You can have as many boards as you want, all fully configurable (using the "server" app on the computer the keyboard is sending key events to.)

Right now, I'm learning APL using it; it's pretty comfortable for that. An important point, though, is that APL has a finite number of extra keys. Every symbol you insert in a source file is a symbol other developers have to have a way of typing—so, while this system can work for APL or arbitrary-symbol-lang-with-a-keyboard-conf-file-in-the-installer, it won't let you just define whatever symbols you please on a file-by-file basis.[1]

[1] ...for now. I'm thinking about writing an IDE hook that scans your project for symbols your keyboard can't type given your board-set, then dumps them into a temporary "project keyboard palette", that you get to by swiping to the left/right. This would let you go beyond Unicode to use arbitrary pictorial symbols (i.e. SVG images) as characters. If you could drag keys off your palette and onto your personal boards, keyboard symbology would then become a memetic process, spreading from project to project when the symbol is useful to the reader, much like words spread in conversation.

Re:Programming languages have to break free from the tyranny... by cdavid on Saturday October 30, 2010 @04:00PM (#1851672)
Typing is not such a big issue. I mean, many languages require many more symbols than keys on a keyboard, and are used every day by millions of people who are not programmers and without any particular technical skill (think Japanese and Chinese).

Practically, having to regularly deal with Japanese encoding, a big issue is interoperability. Granted, a lot of issues are caused by not using unicode (unix vs windows encodings which sadly are still pervasive), and those could be mitigated by enforcing unicode.

I am not so much concerned about readability: mathematics go away with tons and tons of symbols, and it is not really ambiguous - certainly less so than most programming language syntaxes I know.

Re:Programming languages have to break free from the tyranny... by omaranto on Saturday October 30, 2010 @07:07PM (#1852012)
Mathematics, like most languages meant for humans, is ambiguous -- maybe less than most, though. Programming languages are so unambiguous, on the other hand, that not only people but even computers can understand them!
Re:Programming languages have to break free from the tyranny... by cdavid on Saturday October 30, 2010 @08:01PM (#1852105)
What's ambiguous about mathematical notation ?
Re:Programming languages have to break free from the tyranny... by simonb on Sunday October 31, 2010 @10:14AM (#1853267)
Re:Programming languages have to break free from the tyranny... by pbhjpbhj on Saturday October 30, 2010 @08:14PM (#1852124)
[1,2]

Meaning?

Re:Programming languages have to break free from the tyranny... by cdavid on Sunday October 31, 2010 @06:12PM (#1854496)
Well, what does a + b means in C++ ? You are playing with the work meaning here. Of course, the syntax of a language is well defined - because it needs to be parsed, hopefully somewhat unambiguously by compiler/interpreter.

But that's not very interesting, because that's not really how we program, at least not anymore: you write something to be read by other people more than something to be understood by computer, and two equivalent programs are often not equivalent at all in readability. So maybe my choice of words was not optimal, and I should have chosen readability instead of ambiguity.

I think the focus on being executable by the computer is the wrong one. That's the trivial part.

Re:Programming languages have to break free from the tyranny... by contextfree on Saturday October 30, 2010 @12:35PM (#1851187)
Emacs and MS Word/OneNote support quasi-LaTeX syntax which seems to work pretty well - is this not acceptable to you?
Re:Programming languages have to break free from the tyranny... by gojomo on Saturday October 30, 2010 @06:42PM (#1851973)
How do I type it?

Soft keyboards and composing-entry are the future.

Re:Programming languages have to break free from the tyranny... by zokier on Saturday October 30, 2010 @02:05PM (#1851417)
Trigraphs.
Re:Programming languages have to break free from the tyranny... by RyanT on Saturday October 30, 2010 @01:20PM (#1851298)
That's your reply? Your keyboard is too limited? Your made in China, costs about 1/1000th of an annual programmer salary, trivially replacable hunk of plastic KEYBOARD is your rationale for waving goodbye to the potential productivity benefits of new glyphs? Amazing.

Yes, if only developers could devise some way of remapping keyboard keys, affixing new labels or even creating entirely new alternative layouts and devices. But that sort of rocket science is at least, what, three decades out?

Re:Programming languages have to break free from the tyranny... by jerf on Saturday October 30, 2010 @02:19PM (#1851448)
Two problems with your post, not counting your tone: Your reading comprehension fails, I already mentioned I know how to remap keys. In fact what happens when you type on my keyboard bears only a passing resemblance to what is on the keycaps.

Second, what "productivity benefits"? Are you such an astonishing programmer than your primary bottleneck is typing your symbols? It's too slow to type -> instead of Alt-Gr->, or whatever? Or maybe the agony of having to read -> instead of →? I find it hard to believe that's much more than a rounding error.

Re:Programming languages have to break free from the tyranny... by thomasz on Sunday October 31, 2010 @05:38AM (#1852944)
> Second, what "productivity benefits"?

I guess that mathematical notation is often easier to read and comprehend. I'd rather see something like this http://upload.wikimedia.org/math/9/6/9/9695855b7c5869aad99fa... than something like

    sum [ for x in s -> f(x) ]
on the other hand, without an IDE that's capable of translating between both notations, editing would be rather painful