Skip to content

Instantly share code, notes, and snippets.

@cooldome
Created April 8, 2017 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cooldome/0f334cc0feaf5ac1c60082b73eec8a25 to your computer and use it in GitHub Desktop.
Save cooldome/0f334cc0feaf5ac1c60082b73eec8a25 to your computer and use it in GitHub Desktop.
macro newSeq
macro dseq(len : int) : typed =
let procTyped = newNimNode(nnkBracketExpr).add(bindSym("newSeq")).add(bindSym("int"))
result = newCall(procTyped, [len])
let a = dseq(10)
@cooldome
Copy link
Author

cooldome commented Apr 8, 2017

Does not compile with error:
Error: value of type 'seq[int]' has to be discarded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment