On 10.09.2018 18:51, Alessio Stalla wrote:
Yes, but a toString method with side effects is a really bad coding practice that won't be fixed simply by reducing the power of GString.

well...

class Wrapper {
  def x
  String toString(){x}
}

def w = new Wrapper(x:1)
def gstring = "$w"
assert gstring == "1"
w.x = 2
assert gstring == "2"
w = new Wrapper(x:3)
assert gstring == "2"

I don't think that example really falls under your really bad coding. You have this problem with lists and maps all the time

bye Jochen

Reply via email to