Is it somehow possible to printout all used functions including their parameters and types at built time e.g. via a macro(s) for example. I tried a few things, but nothing worked. In the forums/google I only found some old posts which leading in the direction that this is not possible. I am wondering if this is still the case or if something has changed with 2.0.
Best case, I would get an output like the definition in the source code e.g. proc find*T, S: int {.inline.}= ... or at least the types finally used (for generics for example)
Worst case, at least the function name ?
... and btw can you confirm there is still (in 2.0+) no way to statically built the standard library ?
thx, Holger
You can sorta do that with nimsuggest . If you know filename, line and column of a function then you can list it's usages with a command use <file>:<line>:<col> and nimsuggest will return parseable output. Example:
use src/brewpasspkg/utils.nim:14:13
use skTemplate utils.printOrAsk template (setting: Setting): untyped /home/archargelod/Fluffy/code/nim/brewpass/src/brewpass.nim 132 15 "" 100
use skTemplate utils.printOrAsk template (setting: Setting): untyped /home/archargelod/Fluffy/code/nim/brewpass/src/brewpass.nim 133 18 "" 100
You could in theory parse your source code and query every token with nimsuggest to get all used functions.
..there is still (in 2.0+) no way to statically built the standard library?
I believe, Nim is already statically builds, (except, maybe, ssl). But it depends on the libc, that's by default linked dynamically in practically every language. If you want to use static libc - Nim code can be compiled with static musl-libc: