Open timotheecour opened 3 years ago
I wonder if a reevaluation of Nim's CLI interface isn't in order. Not necessarily a redesign, but just some analysis for issues and redundancies - looking at the current full help is... a lot.
Rather than dumping a selection of metadata to a file, what about:
proposal
add a flag
--dump:filename
to nim cmdline which allows generating compiler output metadata to a json file, which can then be used for tooling; eg:design goals
doc, c, js, r, check
etcwhy json?
because it's simple and universal and will not cause a performance bottleneck for the data being generated. In particular,
nim genDepend main
generates a custom text format deps file which can't be extended without introducing a breaking change, whereas json output can be extended by adding additional fields without a breaking changewhy not
nim genDepend main
?genDepend
generates a custom format text file instead of json (not extensible without breaking change)nim js main
)why not
nim dump main
?that's a separate command, it doesn't compose with other commands (eg
nim c main
) and can't be used for such purposeswhy not
nim c --genScript main
?--genScript
serves a different purpose (generating a compile script), and doesn't compose with other commands (egnim js
ornim r
ornim check
etc); it also modifies behavior ofnim c
as it doesn't actually generate object files and a binary but instead is used as precursor for another commandThat said, a lot of the code can be shared and reused in the implementation of
--dump
since it also generates a json file innimcache