> Q: Why are backslashes (\) used as language operators? Isn't that confusing, given they're used in other languages as escape characters?
> A: This is a valid point, but backslashes were chosen for a purely pragmatic reason; on virutally all keyboards, backslashes are very easy to type (requiring only a single keystroke). This is a handy property for backslashes to have because in ANI, you'll be typing them a lot!
> Incomers from other languages might be thrown off a tiny bit, but a programmer that's spent some time with ANI will quickly come to realize that there is actually never any good reason to end a line of ANI code with a syntactual backslash! If one insists on doing so anyway, they are writing ill-formatted code that would be confusing regardless of how backslashes are interpreted by the language. Thus, the backslash conflict is there in theory but irrelevant in practice.
> The usage of \ in the language syntax is a thought-out practical compromise, though the issue may be reconsidered in the future depending on programmer feedback.
> on virutally all keyboards, backslashes are very easy to type
That's such a typical US-centric attitude. On (most?) European Apple keyboards, "\" is alt+shift+7 or some similar Vulcan death grip combo. Not exactly "very easy to type".
Yeah right, I guess the 100 millions or so French-speaking people don't amount to much. On French keyboards it's ctrl+alt+"<" (which is at the bottom left of the keyboard), or, when available "Alt Gr"+"\".
Going out of your way to produce such small and dubious improvement is always a bad idea imho.
If you really think C syntax is a pain point, the sanest thing to do is to go with textual keywords like in ruby or lua.
Keywords are reasonable easy to type (I'm much faster typing plain text without
special characters), simple to auto-complete and read very well. For example,
they could have used something like "to" instead of "->", eg:
"Hello World" to std.out
That's just an idea I had on the spot, not sure how it would play out. But I
think this stream programming would actually lend itself well to some sort of
literate syntax.
This is indeed what I meant. Typing "end" is, for me at least, way faster than typing "}". The reason is that "end" does not require modifier keys, and that all the letters are relatively accessible in the middle of the keyboard. (If you don't speedtype, this might not make as much a difference.)
Thanks for the elaboration. I might even agree about the typing, even though e.g. `end' requires one keypress more than } for me. But I find that punctuation stands out more. From a practical point of view, I prefer reading Haskell's
\arguments -> body
to Scheme's
(lambda (arguments) (body))
because it stands out more. What gives me as the reader an even better hint without getting in the way, is indentation. That's why I prefer that to e.g. curly braces for reading. (Writing, especially in non-programming editors, like a webform, is easier with explicit markers like `end' or } though.)
You do know that "\" doesn't even exist on Japanese keyboards, right? It was replaced by "¥" a long time ago.
If you were serious about making things easy, you'd look at all the common keyboard layouts (not just American ones) before choosing a "thought-out practical compromise" that is of dubious practicality.
They should really try that on a German keyboard. On mine, backslash is not even listed on the keys as an icon. (Same for Swedish, Norwegian, or Dutch, I think).
> Q: Why are backslashes (\) used as language operators? Isn't that confusing, given they're used in other languages as escape characters?
> A: This is a valid point, but backslashes were chosen for a purely pragmatic reason; on virutally all keyboards, backslashes are very easy to type (requiring only a single keystroke). This is a handy property for backslashes to have because in ANI, you'll be typing them a lot!
> Incomers from other languages might be thrown off a tiny bit, but a programmer that's spent some time with ANI will quickly come to realize that there is actually never any good reason to end a line of ANI code with a syntactual backslash! If one insists on doing so anyway, they are writing ill-formatted code that would be confusing regardless of how backslashes are interpreted by the language. Thus, the backslash conflict is there in theory but irrelevant in practice.
> The usage of \ in the language syntax is a thought-out practical compromise, though the issue may be reconsidered in the future depending on programmer feedback.
To see what the backslash does, see the Pipes section: http://code.google.com/p/anic/wiki/Tutorial
Edit: I'm not defending these arguments, simply pointing out that the developers have put forth some reasons.