Presentation at JCrete.org

Brian Goetz brian.goetz at oracle.com
Mon Jul 24 16:02:16 UTC 2023


>
> Let's take another example, a builder. I see no problem to have a 
> template processor that acts as StringBuilder/StringJoiner.
>
> var joiner = new StringJoinerAndTemplateProcessor();
> for(...) {
>   joiner."""
>    several lines and \{ holes }
>    """;
> }
> return joiner.toString();
>
> I do not see why I can not to that.

I am sorry to hear this.  This is a needlessly-bad design.

The invocation of ."..." has an effect, but there is no verb visible.  
What does it do?  (I am not looking for an answer; the fact that I have 
to ask makes this a terrible API design.)

Whereas, when TemplateProcessor behaves more like Function, it is clear 
what it does; takes an X, and gives me a Y.  (It is then on me to handle 
the Y properly.)

>
> Designing is about trying to separate different concerns.

And having LOG."..." do both the formatting and the logging side-effects 
is cramming two separate concerns into one.


I think it is probably time to end this conversation here, though; 
further arguing about "I wish the design center of this feature were 
different" doesn't seem counterproductive, and it seems you are pretty 
much there.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230724/56856fb0/attachment-0001.htm>


More information about the amber-dev mailing list