Programmer's Guide To Text Blocks
Jim Laskey
james.laskey at oracle.com
Mon Aug 12 11:46:01 UTC 2019
Thank you, Tagir.
Understand and sympathize with your comment, but it's not quite the same scenario. The example you give (sort of) requires alignment with an element (first arg) of the opening line. The point we are trying to carry is that the content "doesn't" need to (maybe shouldn't) align with the opening delimiter. That is, don't get fixated on doing so. A more relevant example is;
String[] keywords = new String[] {
"red",
"green",
"blue"
};
We wouldn't expect to align on the open brace in this case.
Cheers,
- Jim
> On Aug 12, 2019, at 3:01 AM, Tagir Valeev <amaembo at gmail.com> wrote:
>
> Hello!
>
> In general, looks good, thanks!
>
> > Guideline: Avoid aligning the opening and closing delimiters and the text block's left margin. This requires reindentation of the text block if the variable name or modifiers are changed.
>
> I'm not sure about this recommendation. Reindentation could be necessary in other cases as well, e.g. if you move this declaration to the nested block. I think every IDE will take care of any necessary reindentation for you. It's similar to a method declaration that contains several parameters one per line. E.g. (from OpenJDK Collectors class):
>
> public static Collector<CharSequence, ?, String> joining(CharSequence delimiter,
> CharSequence prefix,
> CharSequence suffix)
>
> Here three parameters are indented in the same way: if method name, modifiers, return type or type parameters ever change, this would require the reindentation of second and third lines (and IDEs do this automatically). Is such a code style acceptable for Java? If yes, then indenting opening and closing delimiters of the text block should also be acceptable, in my opinion.
>
> With best regards,
> Tagir Valeev.
>
> On Mon, Aug 5, 2019 at 7:38 PM Jim Laskey <james.laskey at oracle.com <mailto:james.laskey at oracle.com>> wrote:
> The enclosed PDF is the content of the proposed "Programmer's Guide To Text Blocks". Document source is located at
>
> http://cr.openjdk.java.net/~jlaskey/Strings/TextBlocksGuide_v8.md <http://cr.openjdk.java.net/~jlaskey/Strings/TextBlocksGuide_v8.md>
>
> http://cr.openjdk.java.net/~jlaskey/Strings/TextBlocksGuide_v8.html <http://cr.openjdk.java.net/~jlaskey/Strings/TextBlocksGuide_v8.html>
>
> Please review and comment back to this mailing list.
>
> Cheers,
>
> -- Jim
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190812/b60eaed2/attachment-0001.html>
More information about the amber-spec-experts
mailing list