News for hackers. Stuff that matters.
Re:Anic - Faster than C, Safer than Java, Simpler than *sh by chime on Tuesday August 14, 2012 @11:53AM (#4381516)
http://code.google.com/p/anic/wiki/FAQ

> 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.

Re:Anic - Faster than C, Safer than Java, Simpler than *sh by lobster_johnson on Tuesday August 14, 2012 @12:04PM (#4381590)
> 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".

Re:Anic - Faster than C, Safer than Java, Simpler than *sh by norswap on Tuesday August 14, 2012 @12:03PM (#4381582)
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.

Re:Anic - Faster than C, Safer than Java, Simpler than *sh by chime on Tuesday August 14, 2012 @12:30PM (#4381741)
Sorry, I'm not the developer. I was just saying that the FAQ explains the choice of backslash, regardless of whether it is sane or not.
Re:Anic - Faster than C, Safer than Java, Simpler than *sh by norswap on Tuesday August 14, 2012 @06:51PM (#4383482)
I understand that, my reaction was of course towards the developer explanation and not you.
Re:Anic - Faster than C, Safer than Java, Simpler than *sh by eru on Tuesday August 14, 2012 @12:10PM (#4381625)
> 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.

Why?

Re:Anic - Faster than C, Safer than Java, Simpler than *sh by slowpoke on Tuesday August 14, 2012 @02:17PM (#4382311)
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.
Re:Anic - Faster than C, Safer than Java, Simpler than *sh by norswap on Tuesday August 14, 2012 @06:55PM (#4383493)
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.)
Re:Anic - Faster than C, Safer than Java, Simpler than *sh by eru on Wednesday August 15, 2012 @10:51AM (#4386210)
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.)
Re:Anic - Faster than C, Safer than Java, Simpler than *sh by kstenerud on Tuesday August 14, 2012 @12:19PM (#4381681)
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.

Re:Anic - Faster than C, Safer than Java, Simpler than *sh by dkersten on Tuesday August 14, 2012 @01:01PM (#4381895)
How do you do escape sequences in C (or pretty much every other language)?
Re:Anic - Faster than C, Safer than Java, Simpler than *sh by kstenerud on Tuesday August 14, 2012 @01:32PM (#4382053)
printf("Some message¥n");

DOS and Win9x were particularly disgusting: C:¥DIR¥SUBDIR¥README.TXT

It's regarded more as a necessary evil than anything else. Any language featuring it prominently will be unlikely to achieve much popularity in Japan.

Re:Anic - Faster than C, Safer than Java, Simpler than *sh by Someone on Tuesday August 14, 2012 @01:38PM (#4382088)
The reason why that works is that it is not that the Japanese keyboard layout that lacks the backslash, but the Japanese character set. See (http://blogs.msdn.com/b/michkap/archive/2005/09/17/469941.as... for details)

Also, in C, you can just type ??/ instead of backslash.

Re:Anic - Faster than C, Safer than Java, Simpler than *sh by dkersten on Tuesday August 14, 2012 @01:44PM (#4382124)
So, as far as ANI is concerned, you could just do latch¥ - no problem ;-) though ugly.
Re:Anic - Faster than C, Safer than Java, Simpler than *sh by eurleif on Tuesday August 14, 2012 @01:34PM (#4382066)
What does Ruby do?
Re:Anic - Faster than C, Safer than Java, Simpler than *sh by chime on Tuesday August 14, 2012 @12:29PM (#4381734)
Sorry, not the developer. Just someone who read the FAQ.
Re:Anic - Faster than C, Safer than Java, Simpler than *sh by terhechte on Tuesday August 14, 2012 @12:05PM (#4381592)
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).
Re:Anic - Faster than C, Safer than Java, Simpler than *sh by cygx on Tuesday August 14, 2012 @12:30PM (#4381740)
Then you have a non-standard keyword. Standard layout has \ on the same key as ß (the base letter) and ? (the shift variant).
Re:Anic - Faster than C, Safer than Java, Simpler than *sh by Osiris on Tuesday August 14, 2012 @12:17PM (#4381674)
How do you type paths in Windows? Do you use the forward slash instead?