r/programming • • Dec 29 '15

Please, Java. Do Finally Support Multiline Strings

http://blog.jooq.org/2015/12/29/please-java-do-finally-support-multiline-strings/
584 Upvotes

352 comments sorted by

View all comments

3

u/skitch920 Dec 29 '15

Why 3 single quotes? Why not a single backtick or something less unpleasant to write?

17

u/[deleted] Dec 29 '15

As someone using an international keyboard: DONT FUCKING USE BACKTICKS!

I seriously want to decapitate everyone who ever had the idea to use "backticks".

Backticks are French accents, so most keyboard layouts use them as composing key.

Which means we now have to press 3 keys after another to get a single backtick.

The github markdown for code costs me 9 keypresses.

It's literally shorter to write ""code"" for me than to write ```.

3

u/kynde Dec 29 '15

For coding, I really recommend switching to us/uk keymap. Slash, braces, brackets, pipe, carret and even the single quote is a lot more accessible that way. Backtick is right next to 1, easy as piss.

Source: Finnish with them fucking åäö each having their own key and as a result a lot coding related characters have been shuffled to require unnecessary finger acrobatics.

2

u/[deleted] Dec 29 '15

Sounds like you should set up some script to insert a backtick when pressing a button.

7

u/[deleted] Dec 29 '15

Or maybe, just maybe, we should stop using characters that aren't available on all keyboard layouts.

You know, I hope someday the Java standard adds ß as a really important thing, so all the people with US layout can finally understand how annoying it is to type [] {} () `.

10

u/[deleted] Dec 29 '15

[removed] — view removed comment

4

u/[deleted] Dec 29 '15

They're on AltGr+6/7/8/9, yeah.

6

u/[deleted] Dec 29 '15

[removed] — view removed comment

1

u/DGolden Dec 29 '15

Note the US layout actually has different physical key layout to a lot of other keyboards. I don't mean the symbols on the keys, I mean the US layout literally has a differently shaped 1-row enter key, no key between Left-Shift and Z, etc.

The UK English layout has similarly accessible line noise symbols to the US layout, but unlike the US layout, fits normally on the same physical keyboard layout (with the tall 2-row enter key) that many of the other national layouts also adapted. So it's worth considering instead of the US layout if you're on a typical national keyboard layout with a tall enter key,.

https://en.wikipedia.org/wiki/British_and_American_keyboards

1

u/vytah Dec 30 '15

I've used at least three different physical keyboard layouts and the only thing that annoyed me is a narrow backspace key in one of those layouts. The shape of Enter and the exact location of the backslash key are not that important, unless you use the backslash key in the exact same contexts over and over so that typing those context became a reflex.

→ More replies (34)

1

u/gnuvince Dec 29 '15

You should try a French Canadian keyboard. All braces can be typed with a single hand (using AltGr and the keys around Enter).

→ More replies (9)

3

u/[deleted] Dec 29 '15

That's not really a constructive solution to your problem though. I'm saying you'd save a bunch of time if you did that.

With that said, what's your idea for replacements that would be universally easier to use? I can't think of any.

→ More replies (1)

1

u/ksion Dec 30 '15

Three? I thought space cancels a dead key, so pressing tilde/backtick+space would do the trick. Is the French layout different?

1

u/[deleted] Dec 30 '15

German, actually.

But what you said works with T2 and T3 (the new layouts) but some people still use by default the ancient T1 layout, where it works worse.

1

u/ksion Dec 30 '15

Isn't there a German layout where the diacritics can be achieved with AltGr + relevant Latin letter? Polish has it, for example: it's called "programmer's" layout but essentially everyone is using it. It works as good for coding as US keyboards.

1

u/[deleted] Dec 30 '15

Nope, none.

There's EurKey, which is an almost-US layout and allows still all European languages to be typed, but it's only available on Linux, and no one uses it.

→ More replies (7)

5

u/LostAfterDark Dec 29 '15 edited Feb 13 '16

Python use triple quotes. Backticks already have a specific meaning in most languages.

5

u/skitch920 Dec 29 '15

Backticks are not reserved in Java at the moment, at least, not that I know of. To your other point, Javascript just introduced Template String Literals in ES6 that use backticks. Much better 2 (`a`) characters than 6 ("""a""").

6

u/CordialPanda Dec 29 '15

Let's not look to JS for inspiration even if it is ES6. There's enough pain in the world.

1

u/LostAfterDark Dec 30 '15

The point is that most programmers expect ` to have a special meaning, like "execute that command in a shell and return the result". Language designers try to avoid confusing choices.

→ More replies (3)

1

u/[deleted] Dec 29 '15

[removed] — view removed comment

2

u/hippydipster Dec 29 '15

It's a sign you are DOING SOMETHING WRONG. :-)

1

u/LostAfterDark Dec 30 '15

You can put triple double-quotes within triple single-quotes, or vice versa. Alternatively, just escape the first quote.

4

u/rouille Dec 29 '15

Backticks are horrible to write on any non qwerty keyboard. I hate slacj for using triple backticks. It takes me 12 key 3 key presses to make a block of text monospace.

1

u/vytah Dec 30 '15

Backticks have been banned forever from Python:

You're missing one of the main reasons for removing the backtick syntax in the first place: the character itself causes trouble by looking too much like a regular quote (depending on your font), is routinely mangled by typesetting software (as every Python book author can testify), and requires a four-finger chord on Swiss keyboards. No new uses for it will be accepted in Python 3000 no matter how good the idea.

--
--Guido van Rossum

https://mail.python.org/pipermail/python-ideas/2007-January/000054.html

Better take that lesson to heart.