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> in l3keys #1010

Closed
jlaurens opened this issue Oct 31, 2021 · 2 comments
Closed

<boolean> in l3keys #1010

jlaurens opened this issue Oct 31, 2021 · 2 comments
Assignees
Labels
documentation Issues in the documenation

Comments

@jlaurens
Copy link
Contributor

In l3prg <boolean> stands for "boolean variable" contrary to l3keys where <boolean> stands for "boolean value" (see .set_bool:N documentation)

Suggestion

Replace <boolean> with <boolean value> in l3keys (conforming to the error message below).
Moreover, in .set_bool:N, true and false really mean the strings "true" and "false" and not the booleans.
Adding quotes would help a lot.

A bug in an error message

MWE:

\documentclass{article}
\ExplSyntaxOn
\keys_define:nn { my } {
  key .bool_set:N = \g__my_bool,
  key .initial:n = \c_true_bool,
}
\keys_set:nn {my} {}
\ExplSyntaxOff
\begin{document}
ABC
\end{document}

The error message reads

! LaTeX3 error: Key '' accepts boolean values only.

The 'key' is missed. For .default:n instead of .initial:n, the 'key' is properly catched.

Suggestion: \bool_to_str:N and \bool_to_str:n would be welcome

It would simplify the use of <booleans> as <boolean values>.

key .initial:x = \bool_if:nTF {<boolean expression>} {true} {false}

would be replaced with

key .initial:x = \bool_to_str:n {<boolean expression>}
@blefloch
Copy link
Member

blefloch commented Nov 1, 2021

I'm starting to make in an upcoming pull request most of the changes you suggested in various issues. I've added \bool_to_str:N and c and n analogues.

In l3prg <boolean> stands for "boolean variable" contrary to l3keys where <boolean> stands for "boolean value" (see .set_bool:N documentation)

No, in both cases <boolean> is a boolean variable like \l_foobar_bool. I've changed five occurrences to boolean value in l3keys to insist on that (and for consistency with other variable types in this file). I've added quotes as suggested around true and false.

bug in an error message

Thanks, it seems more general so I've logged it at #1013.

@blefloch blefloch closed this as completed Nov 1, 2021
@blefloch blefloch reopened this Nov 1, 2021
@blefloch
Copy link
Member

blefloch commented Nov 1, 2021

Sorry for the noise, I'll close it with a commit comment, this way it will get closed once the pull request is merged.

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

No branches or pull requests

2 participants