[movitz-devel] Re: Sets of constants
Luis Oliveira
luismbo at gmail.com
Sat Mar 24 16:18:20 UTC 2007
Frode Vatvedt Fjeld <ffjeld at common-lisp.net> writes:
> My own idea so far is to define for each set of constants a pair of
> functions, where the first function maps names (symbols, or keywords
> if the definition is supposed to be used from outside the package) to
> values, and the second maps values to names. Compile-time expansion of
> constant names will be provided.
[...]
> Any other ideas, concerns, or experiences?
FWIW, we have a similar need in CFFI for enums and bitfields and we use
two operators (integer to symbol and and vice-versa) that take the type
as their first argument. In the case of bitfields an integer usually
maps to more than one symbol, of course.
Why not plain old +constants+ with defconstant? I'm not suggesting
that's a better idea, just curious.
--
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/
More information about the movitz-devel
mailing list