> Then when you are on the development branch of nim, error has a second
> optional argument, that allows you to pass a NimNode, so that positional
> information from that node gets printed on the cosole whe the error occurs.
I am using that now. Tnx.
Do you by the way know if Nim supports static constructors? I want to do
something like the following:
# Pseudo
type
Matrix[M, N: static[int], T] = object
data: array[M * N, T]
proc newIdentityMatrix[N, T](): Matrix[N, N, T] =
# fill result with zeroes?
for row in 0 .. <N:
for col in 0 .. <N:
result[(row * N) + col] = T(1) # Scalar product identity of type
let x = newIdentityMatrix[4, float]() # Static square matrix set to identity
Tried many things without luck