On Fri, Apr 30, 2021 at 7:51 PM 'Valentin Deleplace' via golang-nuts
<
golan...@googlegroups.com> wrote:
> func f() string {
> s := "a" + "b"
> return s
> }
Handled by constant folding.
> func g() string {
> s := "a"
> s += "b"
> return s
> }
The second assignment to 's' here is not a constant expression but a
value computed at runtime. A different mechanism may detect this
optimization opportunity, provided it's possible without changing the
semantics of the program.