[CLJ-1368] Document usage for case with non-readable constants Created: 02/Mar/14 Updated: 02/Mar/14
It is pretty obscure how to get constant-time dispatch for e.g. Enums, even if user knows about case.
The possibility to dispatch to arbitrary constants with case, by wrapper macro, should be documented.
Case is documented for accepting all readable forms as test-constants. However, it can also be made to use any compile-time-known constants as test-constants, by wrapping it in another macro.
Sometimes this is appropriate, e.g. when dispatching on a java Enum.
This technique is an application of a more general technique: Passing non-literals to a macro from another macro.
|Comment by Herwig Hochleitner [ 02/Mar/14 11:25 AM ]|
Actually, it's an alternate solution