(now stripIndent)

I've accumulated a few questions/comments on this.

1. When choosing the amount to trim, it ought to ignore blank lines and
only-whitespace lines, right?

Seems right.

2. Is it really appropriate to automatically remove trailing whitespace?

I'm not sure about this either.  The reason that RSLs will have "extra" whitespace that needs to be stripped is that we want to indent the RSL snippet relative to the Java code (and as you point out, the IDE may do that automatically for us.)  But if there's trailing whitespace, its because the user put it there, and who is it hurting?  It might be significant.

3. If the input contains *any* tab characters at all (except any that are
part of the trailing whitespace), then this method cannot know that it
isn't jumbling the end result, and maybe it should just throw.
I think there's a middle ground, where it strips any common whitespace prefix.  So if every line starts with tab-tab-space-space, it can safely strip this.

5. If we do end up in a world where we have to call this for almost every
one of our tens of thousands of multi-line RSLs... is it strange that I
feel like I would prefer it was static? It seems like it would look a lot
more normal that way visually. Ugh...
I think this is likely to vary subjectively a lot.  Some people like that the instance method is mostly out of the way; others like the up-front shouting of the static method.

The reason we can't have both is then we can't resolve the method reference String::strip as a Function<String,String>, which seems a useful thing to do.

On top of *that*, I have no idea what "right markers" are good for, nor
what customizing the marker choice is good for (other than creating more
needless variation between different pieces of code).


String asciiArtFTW =
`````````
    `  BOO  `
    `````````.trimMarkers("`", "`");


Reply via email to