Frank Schönheit - Sun Microsystems Germany wrote:
Hi Stephan,
Why use a constants group instead of an enum?
*Sigh*.
Since I seem to remember we once had guidelines saying "enums are Bad
(TM)", since enums are not extensible. Does this not hold anymore?
i am not aware of such a guideline and of course it doesn't make sense
from my perspective. Furthermore i would say it depends on the use case,
if you know that the list of values will growing in the future a
constants group is probably the best choice. But if you know it will be
fixed set of values i would always prefer an enum because API's using
this enum type gets type safe and more intuitive by simply reading the
API's.
Just my 2 cents
Juergen
And if a constants group
is adequate, please use "long" instead of "short"---"long" should be the
canonic way of representing integers in UNO, and "short" arguably could
have been left out of the design entirely (similarly to the "unsigned"
types).
Admittedly, I like short better than long, since it "saves a few bits" -
which hasn't any real-life benefit, probably. However, short would be
consistent with all the other hundreths of constant groups having shorts
- which for my taste is slightly more convincing than "we simply don't
need it" :)
Ciao
Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]