Restarting Java’s Raw String Literals Discussion
It was announced in December 2018 that raw string literals would be dropped from JDK 12. Now, in the new year, discussion related to the design of raw string literals in Java has begun again.
In the post “Raw string literals — restarting the discussion” on the amber-spec-experts OpenJDK mailing list, Brian Goetz references the explanation for dropping raw string literals preview feature from JDK 12 and suggests “restart[ing] the design discussion.” Goetz summarizes the previous design discussions and decisions and lessons learned from the first take on raw string literals, discusses some design questions and trade-offs to be made, and then calls for input on three specific types of observation data:
- “Data that supports or refutes the claim that our primary use cases are embedded JSON, HTML, XML, and SQL.”
- “Use cases we’ve left out…”
- “Data (either Java or non-Java) on the use of various flavors of strings (raw, multi-line, etc) in real codebases…”
Jim Laskey posted two messages with the title “Enhancing Java String Literals Round 2” to the same amber-spec-experts mailing list and references an HTML version and a PDF version of an “RTL2” document that aids in the discussion of “Take Two” of raw string literals. Laskey outlines a “series of critical decision points that should be given thought, if not answers, before we propose a new design.”
A few of the major decisions to be made as raw string literals for Java are reconsidered include these discussed in the aforementioned posts are listed here, but many more are contained in the posts:
- Which is really more important to developers: “raw text” or “multi-line strings”?
- Which character makes for the best delimiter for most Java developers and Java use cases?
- How should incidental spacing be handled?
There has already been some feedback on the amber-dev OpenJDK mailing list. Stephen Colebourne provides “Extended string literals feedback” and Bruno Borges recommends “special assignment rather [than] special delimiters.”
I often see developers complaining about certain language and API decisions after the decisions have been implemented. For anyone with strong feelings about the subject of raw string literals and multi-line strings in Java, now is an opportunity to make one’s voice heard and to possibly influence the final design that will come to Java at some point in the future.
Published on Java Code Geeks with permission by Dustin Marx, partner at our JCG program. See the original article here: Restarting Java’s Raw String Literals Discussion Opinions expressed by Java Code Geeks contributors are their own. |