Re: Sets of constants
Luis Oliveira <[email protected]> Sat, 24 Mar 2007 16:18:20 +0000
| Newsgroups | gmane.lisp.movitz.devel |
|---|---|
| Message-ID | <[email protected]> |
Frode Vatvedt Fjeld <[email protected]> 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/