Created
December 10, 2012 21:05
-
-
Save apriori/4253422 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
SMatrixNM*[M, N, T] = object | |
aij*: array[M, array[N, T]] | |
TMatrixNM*[M, N, T] = ref SMatrixNM[M, N, T] | |
TVector3*[T] = TVectorN[range[0..2], T] | |
proc newObj[T](): T = | |
result.new() | |
macro newBlub(e: expr): stmt = | |
let cs = callsite() | |
var slist = newNimNode(nnkStmtList) | |
var node = newNimNode(nnkCall) | |
var bracket = newNimNode(nnkBracketExpr) | |
bracket.add(newIdentNode("newObj")) | |
#Error: undeclared identifier: 'AnonType' | |
bracket.add(newIdentNode($cs[1].symbol)) | |
node.add(bracket) | |
slist.add(node) | |
return slist | |
var | |
v1 = TVector3[float].newBlub() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment