nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.63k stars 1.47k forks source link

can't use `static seq[string] = ...` param #9863

Open timotheecour opened 5 years ago

timotheecour commented 5 years ago

how can one use a static param of type seq? (note: I don't want to use an array as that would tie default value to be of same length as the param, which is useless for example when default value is @[])

following code fails:

Error: type mismatch: got <static[array[0..-1, empty]]([])> but expected 'static[seq[string]]'
  macro foo(a: static seq[string] = @[]): untyped = discard
macro foo(a: static seq[string] = @[]): untyped = discard
proc main()=
  foo()
main()

this affects https://github.com/c-blake/cligen/issues/66#issuecomment-444310617

timotheecour commented 5 years ago