[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
alist with type checking
From: |
Urs Liska |
Subject: |
alist with type checking |
Date: |
Wed, 04 Feb 2015 14:54:05 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- alist with type checking,
Urs Liska <=