Hi all,

I'm working on (or rather with) functions managing nested association lists
(taken from Jan-Peter's https://github.com/openlilylib/openlilylib/blob/master/ly/_internal/utilities/alist-access.ily).

This is intended to manage a hierarchical object with configuration options for a project or a library.

One thing I didn't manage to come up with so far is a way to add "type checking".

So far a key is created and initialized with a command
\registerOption path.to.key initial-value

Later only registered keys can be modified with a
\setOption new-value
 command.
This is already great, but it would be cool if \registerOption could accept an (optional) predicate argument and store that predicate so that a subsequent \setOption will only be successful if the new value satisfies the predicate.

Any ideas how to achieve that?
I thought about storing a pair of predicate and value instead of only the value but so far it failed completely ;-)

Thanks for any suggestions
Urs

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to