Re: calculated import argument

2018-09-28 Thread geezer9
Very cool. The toImport allows any static string expression to be used as the argument of the import. I had seen the strdefine pragma but did not understand its purpose. THANKS

Re: calculated import argument

2018-09-28 Thread Araq
Wow, I had no idea this is possible. :D

Re: calculated import argument

2018-09-27 Thread jangko
shorter version const apple {.strdefine.} = "default_value" template toImport(x: static[string]): untyped = import x toImport(apple & "tools") Run

Re: calculated import argument

2018-09-27 Thread jangko
import macros const apple {.strdefine.} = "default_value" macro toImport(x: static[string]): untyped = quote do: import `x` toImport(apple & "tools") Run nim c -d:apple=new_value myproject Run

calculated import argument

2018-09-27 Thread geezer9
Is there a way to use a static calculated string value as the argument of an import statement? For example: > import LIB&"tools" where LIB was a defined symbol from the nim compile command - perhaps: > nim c -d:LIB=vector myproject.nim so that myproject.nim would import vectortools.nim Tryin