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.55k stars 1.47k forks source link

The "--" template from module nimscript mis-translates "out" key #6011

Closed ghost closed 5 years ago

ghost commented 7 years ago

In this task from a .nimble file

task testBuild, "build the tests":
  --path: ".."
  --verbosity: 2
  --out: "tests/apitest"
  setCommand "cpp", "tests/apitest"

the --out template call is translated to a --var option in the executed command string. When switch "out", "tests/apitest" is used instead, everything works fine.

mathsaey commented 7 years ago

This seems to be the case since out is a reserved keyword.

template `--`*(key, val: untyped) =
  ## A shortcut for ``switch(astToStr(key), astToStr(val))``.
switch(astToStr(key), strip astToStr(val))

astToStr(path) returns "path", while astToStr(out) returns var

andreaferretti commented 7 years ago

Yet it would be a very simple fix to consider out specially here