String concatenation order of operations

Liam Miller-Cushon cushon at
Wed Sep 8 20:50:23 UTC 2021

On Tue, Sep 7, 2021 at 5:55 PM Brian Goetz <brian.goetz at> wrote:

> (Ouch.  Don't code like this.)


For more context, we've been using the string concat strategy proposed in
the compiler-dev thread I linked to earlier, which is like inline but with
a presized stringbuilder. I'm finally trying to enable the indy strategy,
and I stumbled upon this difference. I haven't seen this in real world
code, but I also haven't looked very hard yet.

I expect this is going to be extremely rare and is also worth discouraging,
so I don't think this will stop us from using indy. Given that the indy
strategy shipped in 9 and this doesn't seem to have come up yet, maybe it
isn't worth worrying about that much.

It'd be nice to reconcile the implementation with the spec if possible,
though. I wonder what the performance hit would be from calling toString on
the arguments more eagerly to preserve the evaluation order.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the compiler-dev mailing list