Another example is the query planner of a good relational database (PostgreSQL, etc.).
Here, SQL can also be viewed as a lazy evaulated programming language, due to its declarative nature and the fact that the execution order is not defined in the code, but instead an (hopefully optimal) execution order is determined by the query planner.
> Not really, you've identified something where the compiler spots a special case pattern and rewrites it
Which, string handling being specifically optimised by the compiler, is exactly what was being discussed upthread?
What was being discussed upthread went a lot further than what you're talking about. The string concat thing is a specific piece of ordinary static analysis that any language with a compile stage can perform. It's also pretty trivially defeated in ways that crop up in real code. I'm not saying it isn't useful, I'm saying it's nowhere close to what would be required to render the performance costs of doing strings the Java way equivalent to the Rust way. Therefore, to go even further upthread, Rust still provides a meaningful choice, trading Java's convenience for Rust's performance.
Closest real world example to a sufficiently smart compiler is GHC, and that can be plenty dumb at times.