Over the last year or two I’ve been doing a lot of PHP (which I really like).One of the things I use a lot is heredoc syntax eg:
$query = <<<END SELECT * FROM tablename WHERE condition1 = $field AND condition2 = 345 END;
This is much more convenient than, say:
String query = "SELECT * " + // MUST remember to put a space here! "FROM tablename " + "WHERE condition1 = " + field + " " + "AND condition2 = 345";
I’ve been doing quite a bit of Java recently and it’s really starting to bug me. I don't understand why pretty much every other imperative language invented in the last 15 years can have some form of multi-line string syntax but Java still doesn’t.
Java 6 was released over three years ago. Java 7—thanks largely to the unexpected (yet welcome) inclusion of closures—isn’t due for nearly another year. Four years between releases.
Surely Java could have gotten something in that time. Even if it’s the rather ugly (imho) triple-quote syntax of Scala/Groovy it’d be better than nothing.
Anyway, I just needed to get that out.
Happy New Year for 2010.