You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a proc accept 2 generic parameters, Nim expects the generics to be instantiated after the first variable.
Test case:
typeMatrix[M,N: static[int]; T: SomeReal] =array[0..(M*N -1), T]
let a =newMatrix[2,2,float]
let b =newMatrix[2,1,float]
procfoo[M,N: static[int],T](a: refMatrix[M, N, T], b: refMatrix[M, N, T])=discardfoo(a, a) #worksfoo(a, b) #worksprocbar[M,N: static[int],T](a: refMatrix[M, M, T], b: refMatrix[M, N, T])=discardbar(a, b) #cannot instantiate: 'N'bar(a, a) #cannot instantiate: 'N'procbaz[M,N: static[int],T](a: refMatrix[N, N, T], b: refMatrix[M, N, T])=discardbaz(a, b) #cannot instantiate: 'M'baz(a, a) #cannot instantiate: 'M'
The text was updated successfully, but these errors were encountered:
mratsim
changed the title
Static - multi-parameters: Nim expect all generics to be instantiated by first variable
Static - multi-parameters: Nim expects all generics to be instantiated by first variable
Apr 1, 2017
When a proc accept 2 generic parameters, Nim expects the generics to be instantiated after the first variable.
Test case:
CC-ing @andreaferretti
The text was updated successfully, but these errors were encountered: