c-blake / cligen

Nim library to infer/generate command-line-interfaces / option / argument parsing; Docs at
https://c-blake.github.io/cligen/
ISC License
496 stars 23 forks source link

explicit converts bool types to int types for quoted variables #221

Closed ringabout closed 1 year ago

ringabout commented 1 year ago

Here is the definition of parReq, which is an int type

parReq*: int        ## flag indicating parameter is mandatory

Here is the definition of isReq, which is a boolean type

let isReq = if i in mandatory: true else: false

In the quote block, isReq is assigned to the parReq field, which has incompatible types.

`apId`.parReq = `isReq`

It is not safe to rely on the type erasure at the compile time, which might be changed in the future => https://github.com/nim-lang/Nim/pull/21433

c-blake commented 1 year ago

Thank you!!