Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean discussion in documentation -- clarify? #25

Open
rpgoldman opened this issue Jul 31, 2024 · 1 comment
Open

Boolean discussion in documentation -- clarify? #25

rpgoldman opened this issue Jul 31, 2024 · 1 comment

Comments

@rpgoldman
Copy link
Contributor

I was working on an application of mine, and reading the documentation

In the readme:

The :boolean/true option kind creates a flag, which always returns T.

The :boolean/false option kind creates a flag, which always returns NIL.

It's not entirely clear what the above means, for a couple of reasons. In particular, it doesn't make sense for these to always return anything. I imagine what is meant is that :boolean/true is going to create an option whose value will normally be nil, unless the user supplies the flag, in which case it will be t.

Being even more fussy: these options don't "return" anything so that's why I said "an option whose value will be" instead of "returns." I believe that "returns" is shorthand for "getopt on the option name will return".

Finally, there's some confusion about how to set the :initial-value of a flag, because it seems the initial value must be either :true or :false even though what getopt gives back is either t or nil. I tried supplying t and got a somewhat cryptic error message.

@dnaeon
Copy link
Owner

dnaeon commented Aug 1, 2024

Hey @rpgoldman ,

The :boolean/true option kind creates a flag, which always returns T.

An example for this one might be an option such as --enable-engine, which when specified on the command-line will always be set to T. This is what the :flag option does internally.

The :boolean/false option kind creates a flag, which always returns NIL.

In a similar way the :boolean/false option does the opposite by setting the value associated with the option to NIL. For example --abort-on-errors option if specified might make decisions to continue with the program execution in case of errors.

These are just helper options around flags.

What you probably want to use is :boolean option which allows specifying a value. For example --enable-logging=false or --enable-logging=true.

I'd be happy to review and make changes to the documentation, if they are unclear, so feel free to propose such! :)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants