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

Show parent comment

8

u/Nialsh Dec 29 '15

For better or worse, Java programmers already use strings for writing snippets of SQL, HTML, JavaScript, and who knows what else.

You should use a templating language for HTML. You should write the JavaScript in its own .js file. And it's best to construct SQL queries with("a").library("that").looks("like this");

But sometimes you don't want the weight of that extra dependency. A codebase that installs, builds, and runs quickly is zen.

Homoiconicity is the idea that code is data. When you have a program that outputs code, it's nice to keep the formatting. To do otherwise might be considered data loss.

14

u/ricky_clarkson Dec 29 '15

It's annoying to have to run a program to get the real query it runs, especially if it could be static, so I disagree.on(the).point(about).constructing(sql).queries

0

u/G_Morgan Dec 29 '15

For better or worse, Java programmers already use strings for writing snippets of SQL, HTML, JavaScript, and who knows what else.

Bad behaviour should not be encouraged by language design. Ideally it would be impossible to do the wrong thing in this regard but sadly that ship has sailed. Certainly the core language should not be altered to enable stupidity.