I'd like to create two objects hold a ref to the same _Matrix_ , what am I missing?
Many thanks for a hint! type Matrix[T] = ref object data : seq[T] MX[T] = object Theta : ref Matrix[T] MXU[T] = object Theta : ref Matrix[T] var M : MX[float] MU : MXU[float] M.Theta= new Matrix[float] #[ gives type mismatch: got 'Matrix[system.float]' for 'new Matrix[float]' but expected 'ref Matrix[system.float]' ]# M.Theta.data= new seq[float] M.Theta.data = @[1.0,2.0] MU.Theta = M.Theta # do both point to the same matrix? MU.Theta.data[0]=7.0 echo M # I'd like to see [7.0,2.0] Run