> Do you by the way know if Nim supports static constructors? I want to do 
> something like the following:
    
    
    type
      Matrix[M, N: static[int], T] = object
        data: array[M * N, T]
    
    proc newIdentityMatrix(T: typedesc; N: static[int]): Matrix[N, N, T] =
      type Out = T
      # fill result with zeroes?
      for row in 0 .. <N:
        for col in 0 .. <N:
          result.data[(row * N) + col] = Out(1.0) # Scalar product identity of 
type
    
    let x = newIdentityMatrix(float, 4) # Static square matrix set to identity
    

Reply via email to