iffy / nim-argparse

Argument parsing for Nim
MIT License
120 stars 8 forks source link

Add docs describing output type of parse #63

Open jmetz opened 3 years ago

jmetz commented 3 years ago

While the docs outline the most basic usage, I was trying to put the try-except for the call to parse inside a proc and return the result... but have no not been able to do better than return a ref untyped.

I see an issue referring to an OptsArgparse type when I used the wrong type, but OptsArgparse isn't defined either.

Could you provide guidance (and ideally docs) on what the return of parse is?

iffy commented 3 years ago

@jmetz at this point, ref untyped is likely the best you can do. I've been annoyed by this limitation a few times, too.

I almost succeeded in getting argparse to generate a consistent type name for the data returned by parse but was prevented by this bug: https://github.com/nim-lang/Nim/issues/16118 I'll see if it's still an issue in the latest Nim.

jmetz commented 3 years ago

Thanks @iffy - I had wondered if that might be a current language limitation/bug. For now I'll just be careful and make do with a void pointer :sweat_smile: