#= Commenting =# very inconvenient on Spanish language keyboard


#1

It may be too late to reconsider commenting syntax but I just thought I’d throw this out there… I’ve been thinking about it for some time. In order to type #= =# I have to use:

(1) left hand pinky + index
(2) right hand pinky + index
(3) grab the mouse and select the end of the line (In the case the text is already written)
(4) move right hand back to keyboard and use pinky + index
(5) left hand pinky + index

I live in a Spanish-Language country and so the keyboard layout is a bit different, mainly for punctuation. I can’t remember where everything is on the English language keyboard so this may not be a problem for some.

I really like JS comment syntax ( /* */ ) just for its ease of use …the two keys are right beside each other.

Of course, I can continue using #= =# if that’s the way it has to be …also I recognise that many editors have Ctrl/cmd + / (as per Juno), which is slightly more convenient but still requires both hands. I’m not sure if this effects enough people to merit more attention but thought I’d mention it.


#2

Languages that have more letters than English usually make compromises to fit on a standard-size keyboard and sacrifice less frequently used punctuation characters first. Eg many European languages have widely used layouts that require acrobatics for []{}#| etc.

There is no good solution that satisfies everyone, so many programmers just use an US keyboard layout, even if their native language is not English.

Alternatively, a reasonable editor should allow convenient shortcuts for everything.


#3

Hello, I’m french and understand your concern, after years of coding with a french azerty keyboard, I move to a regular english qwerty and I’ve never regretted it.

I know you’ve ñ on spanish keyboards it’s just “alt + n” on an english internationnal keyboard.

Otherwise use a shortcut in your ide for commenting code, in atom it’s “ctrl + /” for example.

[Troll] don’t use comments they’re code smell :smile: [/Troll]


#4

Thanks for sharing your thoughts guys :+1:, I guess next time I visit the family I will throw an English language keyboard in my bag before coming home. Until then I’ll use the IDE short cut.


#5

I really hate this syntax and wish we hadn’t added it to the language at all. Or if we did that we’d used #( and )# or something like that.


#6

My impression is that it is used sparingly, to comment out code temporarily. On master,

$ grep -r "#=" . | wc -l
34

Since dangling ,s are allowed, I usually just break a line and use #.


#7

It’s probably worth mentioning that although #( comment )# looks nice, it doesn’t really help avoid the keyboard “acrobatics” mentioned above.


#8

My official recommendation is not to use multiline comments :slight_smile:


#9

I think we could just remove multiline comments. Multiple single line comments are just as easy to add with most editors, and the fact that they are only used 34 times in Base supports this move.


#10

Multiline comments are very handy and much less visual offending than multiple single line comments.


#11

Maybe I am just bad at debugging but I love multi line comments. Not having those in R is a major source of annoyance.


#12

okay, well i think having them doesn’t hurt either. Sorry for the noise.


#13

The Spanish keyboard (https://en.wikipedia.org/wiki/QWERTY#Spanish) needs AltGr+3 ("#"), followed by Shift+0 ("=") to typeset “#=”. This is slightly more complex than on my Norwegian keyboard, where I type Shift+3 ("#") followed by Shift+0 ("=") – which is relatively straightforward for touch typists. I realize that the Shift key is easier to reach than the AltGr key (two shift keys + easier to reach).

The Latin American keyboard (https://en.wikipedia.org/wiki/QWERTY#Hispanic_America) needs Shift+3 to typeset “#”, just like my Norwegian keyboard, and Shift+0 for “=”. Thus, fairly easy for a touch typist.


#14

It’s not just for multi-line comments, though! You can do

julia> a = #= hello =# 5
5

which looks a bit ridiculous, but it can be nice if you want to throw in an aside in a complicated expression.


#15

For background on multi-line comments in Julia, see this lengthy discussion: https://github.com/JuliaLang/julia/issues/69


#16

I also find multiline (nestable!) comments incredibly useful.


#17

The fact that these are nesting makes them very convenient for me. Yes, #( ... )# would have been better (@StefanKarpinski v1.0 hasn’t landed yet - yolo :slight_smile: ).

More importantly, someone (I think maybe Jameson?) pointed out you can handily use so-called “multiline” comments within a single line in complex function calls to explain what’s going on

foo(#= person =# "Andy", #= age =# missing, #= favorite language =# "Julia", ...)

Particularly handy in scripts with a lot of hard-coded values.

On the international keyboard issue - could we maybe have some tab-completions for the REPL and Atom/VSCode/etc for some of our more “obscure” ASCII characters/combos?


#18

Every good editor has the ability to customise a shortcut for (un)commenting. Here is a plugin for Vim: https://github.com/tomtom/tcomment_vim

for me it’s the standard gc and gcc letters, which are easily accessible on all kinds of latin keyboards :wink:


#19

Oh God I hope “just use a US keyboard no matter where you are” never becomes the official recommendation.


#20

So far I only worked on german and a bit on hungarian layouts (I personally use US layouts) and writing curly braces, brackets or almost any other kinds of (not-so-)special characters is just not as ergonomic as for example on the US one. I think for coding the US is still one of the better ones and yes, I’d definitely recommend using that one for all the languages I have worked with so far :wink: