OPTIONSng and OPTIONS_SINGLE, OPTIONS_MULTI

Matthew Seaman m.seaman at infracaninophile.co.uk
Mon Jun 11 05:49:47 UTC 2012


Dear all,

In the new OPTIONS framework, we have some great new constructs for
doing really useful stuff constraining what different combinations of
options may be selected.

One of these is OPTIONS_SINGLE which implements a 'radio button'
permitting the choice of 1 item out of N options.  Well, actually, it
allows choosing 1 out of N in its generic form.  Eg.

OPTIONS_SINGLE=	EXAMPLE
OPTIONS_SINGLE_EXAMPLE=	FOO BAR BAZ BLURFL

(permits at exactly one out of FOO BAR BAZ BLURFL to be selected)

Now, supposing the requirement is that 'at most one of those options'
should be selected.  Currently that is done like this:

OPTIONS_DEFINE= EXAMPLE
OPTIONS_SINGLE=	EXAMPLE
OPTIONS_SINGLE_EXAMPLE=	FOO BAR BAZ BLURFL

(requires at most one of FOO BAR BAZ BLURFL to be selected)

I find this unsatisfactory, partly for aesthetic reasons and partly
because it doesn't make much sense to me.  Why should adding a normal
on/off option with the same name as the SINGLE group mean you can choose
either zero or one of these?  It might work if the way options were
presented to the user was more sophisticated than dialog(1), so you
could grey-out the SINGLE options when the controlling DEFINE is turned
off, but dialog doesn't do that.

Surely it is more sensible to say that OPTIONS_SINGLE is strictly
'choose one from these options.'  Then you can implement 'zero or one of
these options' by:

OPTIONS_SINGLE= EXAMPLE
OPTIONS_SINGLE_EXAMPLE=	FOO BAR BAZ BLURFL NONE_OF_THE_ABOVE

Similar arguments apply to OPTIONS_MULTI.

OPTIONS_MULTI= EXAMPLE2
OPTIONS_MULTI_EXAMPLE2= QUX QUUX QUUUX

means 'choose at one or more out of QUX QUUX QUUUX'  You can change that
to mean 'choose any number out of QUX QUUX QUUUX' by:

OPTIONS_DEFINE= EXAMPLE2
OPTIONS_MULTI= EXAMPLE2
OPTIONS_MULTI_EXAMPLE2= QUX QUUX QUUUX

However, this is syntactically identical to just using normal on/off
options with no constraints between them:

OPTIONS_DEFINE= QUX QUUX QUUUX

so that's just redundant.

What do people think?

	Cheers,

	Matthew


-- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
JID: matthew at infracaninophile.co.uk               Kent, CT11 9PW


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 267 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20120611/04aa66aa/signature.pgp


More information about the freebsd-ports mailing list