On Fri, Apr 30, 2021 at 7:51 PM 'Valentin Deleplace' via golang-nuts <golang-nuts@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. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAA40n-UxAAvGNQMn_9_LV3pMtzZk2pHaKSUsCf81RC_bDR8kQw%40mail.gmail.com.