A yen for more symbols
Apparently true: at one point Perl 6 used ¥ U+00A5 YEN SIGN as a zip operator, for the excellent reason that this particular symbol looks like a zip.
my @tile_values = < A B C D E F > ¥ (1, 3, 4, 2, 1, 4)
Sadly this witty visual pun seems to have been deprecated. All programming languages I know of are firmly stuck in the 7-bit ASCII range, where the only currency character is the good old American $ 0x24 DOLLAR SIGN.
There are plenty of useful symbols for programmers once you’re willing to advance into Unicode space:
- Multiplication × U+00D7 MULTIPLICATION SIGN, obviously
- Haskell would surely prefer a real λ U+03BB GREEK SMALL LETTER LAMDA to the backslash currently used for anonymous functions
- Pointers would be less threatening if we could dereference them with a → U+2192 RIGHTWARDS ARROW
- And there are lots of nice symbols we could use for assignment, ↤ U+21A4 LEFTWARDS ARROW FROM BAR for example, and then we could use the EQUALS SIGN for equality and fix several bugs
- Proper logic symbols for and, or, not, which wipe the floor with
&&
,||
,!
- I won’t even try to list the exciting mathematical symbols and the possibilities they open up. Let’s just say we’d all use container operations if ∀ U+2200 FOR ALL were available
Feedback
-
All these extra symbols look lovely when typeset, but they're a hassle to input. To be honest I find «map(» a lot easier to type than ∀ (I cheated and cut-and-pasted it). On the other hand I use those funny double angle quotes because I happen to know the keyboard shortcut for them on my Mac.
-
David, I wasn't being entirely serious, but let me advance my argument.
- reading programs is more important than writing them
- the problem of input is surmountable (after all, plenty of people send text messages using a numeric keyboard, or input e.g. Chinese using a QWERTY keyboard)
- Donald Knuth invented Latex because he was fed up of the poor appearance of academic papers
-
I don't think you're going far enough. I suppose programming languages at least since C have been designed to be written in ascii using a qwerty (or similar) keyboard. Imagine a scripting language designed to be written in kanji, using a (perhaps not yet existing) appropriate input method (eg using a combination of stylus strokes and menu selections).
For a start, all/many of the key terms could be one kanji long. Maybe even whole programs. Kanji for related procedures (eg different types of sorting) could share radical strokes.
A more mundane example: the difference between assignment and testing for equality (ie = vs == in python) could be represented by appending the kanji for 'ma' (question-formation particle) to the end of a statement.
Lots of scope for linguistic Perlesque.
If and when Chinese capitalism really gets going, I can't see them being satisfied with an ancient US coding system and input method.
-
I know you weren't being entirely serious.
But, more seriously, why did you feel compelled to give the unicode code points and the long names of the characters you used? Didn't you trust the chain between you and me to preserve all those lovely characters?
If you go back a few years and look at CACM and SIGPLAN papers from the 60's and 70's you'll see a curious thing. The programs are typeset. They do use × for multiplication; quite often identifiers were typeset in bold (or keywords were) meaning that variables names could be the same as keywords (since they were typographically distinct). «if if > then then then = else else else = fi fi» was correct ALGOL (I think). You'll have to fill in the bold, since I don't trust this blog with it. ;) BCPL does in fact use ¬ in its "publication form", how you type this into your terminal on your computer facility was always a matter for local interpretation.
I once used (and in fact, wrote the help for) an ML system which printed the keyword «fn» as λ (this was in 1994 when something like that was quite radical). It was quite amusing.
-
But, more seriously, why did you feel compelled to give the unicode code points and the long names of the characters you used? Didn't you trust the chain between you and me to preserve all those lovely characters?
I didn't feel compelled -- more of a whim really -- but no, I wouldn't want to depend on the chain. I think the long names are interesting too.
I'm afraid you're right not to trust this blog! I'll sort it out when I run out of things to write about.
if if > then then then = else else else = fi fi