News for hackers. Stuff that matters.
Re:Why do programming languages use curly braces? by buster on Tuesday February 26, 2013 @10:25AM (#5286082)
I always wonder why so many languages are sooo bad to use on a non-us keyboard.. I'd love if language designers would consider other keyboard layouts more often.. :(
Re:Why do programming languages use curly braces? by ygra on Tuesday February 26, 2013 @10:56AM (#5286294)
The APL [1] designers heard you and created a language impossible to type on almost every keyboard layout [2] ;-)

As for me, I've been using US International for a few years by now (because I use too many curly-braces languages and didn't want to give up being able to type ümläüts). But frankly, changing the keyboard layout just for a programming language is a bit evil. In that sense I liked BASIC and Pascal; I don't mind keywords instead of symbols that much either and I tend to be faster typing words anyway.

________

[1]: http://en.wikipedia.org/wiki/APL_(programming_language)

[2]: http://en.wikipedia.org/wiki/File:APL-keybd2.svg

Re:Why do programming languages use curly braces? by itcmcgrath on Tuesday February 26, 2013 @11:20AM (#5286480)
This made me search to see if there was any 256 key keyboards so I could have a key for every byte, but I apparently no one has been that crazy yet.
Re:Why do programming languages use curly braces? by ygra on Tuesday February 26, 2013 @11:32AM (#5286572)
I like many parts of Unicode ∖ Latin-1. 256 keys might not be enough ;-)
Re:Why do programming languages use curly braces? by TheCoelacanth on Tuesday February 26, 2013 @01:46PM (#5287526)
You'll just have to learn to do one of the encodings in your head.
Re:Why do programming languages use curly braces? by dlitvakb on Tuesday February 26, 2013 @10:36AM (#5286155)
Most programmers often write their programs in english anyway, to be easy to share or to review by others (even in closed source software), so it makes sense for programming languages to mostly care about English keyboard layouts.

Anyways, if the keyboard layout is a blocking problem for you, consider changing it to what it suits you the best, or use multiple layouts for different tasks. Every operating system has a keystroke to swap layouts.

Re:Why do programming languages use curly braces? by buster on Tuesday February 26, 2013 @11:06AM (#5286349)
It's not about writing english per se. How often do you need to write {[]}<> in a letter?

Those keys are really easy on US layout but horrible to type on a german keyboard layout. Holding alt-gr and press 7 or 8 or 9 or 0 is surely not impossible to type but compared to US layout it's much more worse, imo.

Fortunately Python does away with the overabundance of curly braces at least.

Re:Why do programming languages use curly braces? by TylerE on Tuesday February 26, 2013 @11:18AM (#5286452)
Why is Alt+9/0 so much worse than Shift+[/]

slightly worse I'll grant, but MUCH worse?

Re:Why do programming languages use curly braces? by ygra on Tuesday February 26, 2013 @11:35AM (#5286590)
It's AltGr, which is on the right side. And that makes it quite awkward to use. I either break half my hand or need both hands. Or resort to Ctrl+Alt on the left side which isn't optimal either ...
Re:Why do programming languages use curly braces? by buster on Tuesday February 26, 2013 @12:16PM (#5286894)
Wow.. now i'm wondering how quickly (if ever) i can adopt to using ctrl+alt instead of that awkward (and hated) AltGr. You never stop learning...
Re:Why do programming languages use curly braces? by TylerE on Tuesday February 26, 2013 @01:09PM (#5287246)
Couldn't you remap your keys so normal (left) Alt is AltGr and right Alt is "normal" Alt? Alt key bindings are pretty rare.
Re:Why do programming languages use curly braces? by ygra on Wednesday February 27, 2013 @03:15AM (#5291260)
They are? Every time I want to access a menu or a control in a dialog by keyboard I need Alt. Also in Far Alt+typing searches which I use frequently to get around the file system. Sure, one could get used to doing that with the other hand, but at least for me it's not that little muscle memory that has to be retrained.
Re:Why do programming languages use curly braces? by TylerE on Wednesday February 27, 2013 @10:10AM (#5292684)
Really? Every program I've ever used uses Ctrl as the primary modifier.
Re:Why do programming languages use curly braces? by ygra on Thursday February 28, 2013 @03:34AM (#5297731)
Shortcuts, yes. Access keys, no.
Re:Why do programming languages use curly braces? by gebe on Tuesday February 26, 2013 @11:41AM (#5286643)
It's AltGr+7/0 though (on german and swedish layouts at least), which is much worse. Open curly brace is a killer if you are doing it with one hand only. Also the AltGr button is only represented on the right side of the keyboard while you get the Shift on both sides, which makes it more awkward to use with two hands in some situations.

edit: Wow, just learned that Ctrl+Alt is the same as AltGr from the comment below. I've only used computers daily for 21 years ...

Re:Why do programming languages use curly braces? by IvarTJ on Tuesday February 26, 2013 @11:39AM (#5286623)
Slightly times a lifetime.
Re:Why do programming languages use curly braces? by jonascopenhagen on Tuesday February 26, 2013 @11:53AM (#5286721)
I write software in English, sure, but my keyboard layout needs to be Danish in order for me to write emails, etc. in Danish. Having to swap keyboard layouts would mean I'd be confused constantly.

On a Danish Mac keyboard the curly braces are written by holding down Alt + Shift + 8. Not exactly an easy combination to hit.

> Most programmers often write their programs in english anyway

I'm not so sure about that. There are tons of places where English proficiency is really low, even among programmers.

Re:Why do programming languages use curly braces? by tbe on Wednesday February 27, 2013 @02:12AM (#5291093)
I write norwegian on a US MacBook just fine. All the weird characters are available by pressing the Option key.

When I first got the laptop I switched layouts between coding and writing mails, but after a while I found that learning the key combos for a few letters was easier for me than switching between completely different layouts.

Re:Why do programming languages use curly braces? by camus on Tuesday February 26, 2013 @11:49AM (#5286698)
it is one thing write programs in english , i have a french keyboard , typing english is fine , the problem is all the non word stuff that are not directly visible on my keyboard like {}[]|\] and so on. You kind of get used to it but frankly i dream of a language with non of these characters, just words. typing def/end doesnt bother me. By the way , that's kind of why i love coffee-script so much.

    myObject = 
       param1 : foo
       param2 : bar
       param3 : baz

    foo bar,baz,boom
my god it is a relief on a non english keyboard... on the mac i get the @attr without using alt-right , that is neat.
Re:Why do programming languages use curly braces? by dexen on Tuesday February 26, 2013 @11:11AM (#5286380)
In Poland, the most common layout is the `Polish (programmers)', virtually the same as US layout, with extra right Alt switching for polish accented characters.

The alternative is `Polish (typewriter)' layout, with accented characters replacing most of punctuation, which doesn't seem to have caught on. Apparently entering accented characters with right Alt is comfy enough.

Surprisingly all that happened in spite of MS Windows default settings -- IIRC up to and including Windows 98, MS Windows defaulted to the legacy `Polish (typewriter)' layout, and only since Win XP (or perhaps 7) it defaults to the common `Polish (programmers)'.

At any rate, have a look at http://www.colemak.com/ which is quite programmer-friendly. I am using a variation of it.

Re:Why do programming languages use curly braces? by nzonbi on Tuesday February 26, 2013 @11:12AM (#5286387)
There is also the possibility of ditching entirely the approach of text based programming, for a more visual approach. This will not work for many people, but for those that it does work, it could improve productivity.

Text is a good way to represent sequences of information. So it fits programs well, to some extent. But programs contains various kinds of information, that doesn't fit well with a textual representation: Hierarchical data, scope, branching flow, loops, dependencies, etc. These can be enhanced by a visual representational that goes beyond just text.

Besides the Visual representation, there is also the UI. Things like Vim for example, can be awesomely productive, in the hands of someone that has mastered it. But I would claim, that there is still space for improvement. With a visual interface, there are lots of things that can be done. Touch interfaces have lots of possibilities. Special inputs devices, would also be a great opportunity. But that would be harder, for obvious reasons. Maybe 3D printing would open opportunities there soon. The key for a visual UI to succeed, is to allow to do more with less effort.

Visual programming has not succeed so far. I would argue that it is because it has not been done right yet. I am currently working on these ideas, with one of my weekend's side projects. Since my time is limited, It is still going to take some time.

Re:Why do programming languages use curly braces? by kps on Tuesday February 26, 2013 @11:55AM (#5286742)
I'm not convinced it can be done right, because alphabets are inherently superior to ideograms. Making a small set of symbols capable of representing language is one of humanity's greatest inventions.

It's good to have an editor (like vi, following TECO) that takes advantage of the fact that this set of symbols is literally at the user's fingertips.

Re:Why do programming languages use curly braces? by nzonbi on Tuesday February 26, 2013 @01:08PM (#5287242)
Thanks for the answers. I am interested in hearing feedback. This is a very interesting topic for me.
Re:Why do programming languages use curly braces? by kitsune_ on Tuesday February 26, 2013 @11:47AM (#5286681)
There are a lot of visual programming environments that are used in the creative industries, environments such as MAX/MSP, Pure Data, Houdini (CGI / FX) or NI Reaktor...

When I look at a complex Reaktor instrument (for instance Razor[1]), the entire paradigm seems to hit a wall at a certain point. The networks driving these instruments are an intricate mess and their visual representation can actually make it harder to grasp them in their entirety.

[1] http://www.native-instruments.com/en/products/komplete/synth...

Re:Why do programming languages use curly braces? by kd0amg on Tuesday February 26, 2013 @10:32AM (#5286129)
FWIW, braces (and brackets and parentheses) aren't all that pleasant to type on a US keyboard either.
Re:Why do programming languages use curly braces? by buster on Tuesday February 26, 2013 @11:09AM (#5286365)
This: https://en.wikipedia.org/wiki/File:KB_US-International.svg

is much easier then this: https://en.wikipedia.org/wiki/File:German-Keyboard-Layout-T2...

Of course that's probably the reason why the braces were chosen at all :P

Re:Why do programming languages use curly braces? by ginko on Tuesday February 26, 2013 @11:21AM (#5286484)
There's dedicated keys for brackets and parentheses in relatively easy-to-reach positions. How could you make that more pleasant?
Re:Why do programming languages use curly braces? by rsaarelm on Tuesday February 26, 2013 @10:40AM (#5286191)
I realized I probably write more curly braces than accented characters during the day and switched to using an US-International style keyboard layout that puts the diacritic characters under the Alt Gr key.
Re:Why do programming languages use curly braces? by kps on Tuesday February 26, 2013 @12:06PM (#5286822)
Treat keyboard layouts as a part of your software tool set. If the one the OS gave you doesn't work well (and they are universally pretty bad), find or build one that does.
Re:Why do programming languages use curly braces? by ginko on Tuesday February 26, 2013 @11:12AM (#5286386)
I'd rather say that keyboard layout designers should consider programming languages more often
Re:Why do programming languages use curly braces? by cpeterso on Tuesday February 26, 2013 @11:29AM (#5286548)
Or programming languages designers should consider keyboard layouts more often. :)
Re:Why do programming languages use curly braces? by camus on Tuesday February 26, 2013 @11:51AM (#5286707)
i agree 100%