Hi,

Attila Lendvai <att...@lendvai.name> skribis:

>> Out of curiosity, in what case do you need to represent “unset fields”?
>
>
> i think an example works better here: consider Swarm, a p2p storage
> solution. its node implementation is called Bee. bees can join
> swarms. there are some well-known swarms: 'testnet' and 'mainnet'.
>
> when someone specifies the swarm field as a symbol naming one of the
> well-known swarms, then some other mandatory fields should default to
> the appropriate values derived from it, *and* the service should warn
> if those fields are also set by the user.
>
> and when one is joining a custom swarm, as per giving a string name in
> the swarm field, then the service should warn when these mandatory
> fields are not explicitly specified.

I see.  The ‘define-configuration’ macro uses 'disabled as a way to
indicate fields that have not been user-specified.  Would that be of any
help in this context?

Another approach would be to use ‘define-record-type*’ and record all
the default values, including those derived from other fields (just like
the default ‘home-directory’ field of <user-account> is derived from
‘name’.)

Does that make sense?

Ludo’.

Reply via email to