PhobosWatch: manifest => enum

"Jérôme M. Berger" jeberger at free.fr
Sat Dec 29 06:57:26 PST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Walter Bright wrote:
> Don Clugston wrote:
>> Walter Bright wrote:
>>> Jérôme M. Berger wrote:
>>>>     :(
>>>
>>> Yeah, I figure I'll get fricasseed over that one. The most compelling
>>> argument is that we already have 3 ways to declare a constant, adding
>>> a fourth gets very difficult to justify. As opposed to a minor
>>> extension to enums.
>>
>> This statement really disturbs me, as this is clearly a major change
>> to an enum.
> 
> It doesn't change existing usage of enum.
> 
	Yes an no: sure, existing code will still compile and work.
However, it confuses things for the programmer. Enums used to have a
clearly delimited function: creating a type based on a group of
related items (the fact that it is implemented as an integral type
should have remained an implementation detail IMO). The fact that
enums may be used (or abused) otherwise is more a misfeature which
allowed the programmer to work around some language limitations. I'm
all in favor of removing those limitations and I understand keeping
the old enum behavior around for compatibility reasons, but
extending the "enum hack" is not the way to do it.

	In other words: some current usages of enum are a hack to work
around some language limitations. Those usages should be deprecated
in favor of another keyword that would allow them plus extra
functionality (e.g. manifest constants) while "enum" is relegated to
its proper usage. I believe anything else would be too confusing
(particularly to newcomers).

		Jerome
- --
+------------------------- Jerome M. BERGER ---------------------+
|    mailto:jeberger at free.fr      | ICQ:    238062172            |
|    http://jeberger.free.fr/     | Jabber: jeberger at jabber.fr   |
+---------------------------------+------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHdmBVd0kWM4JG3k8RAlzPAJ0QKHazsbtH3oheKMnKIccvjBAihACfUDhQ
qQK9A0r3FjLE4WYp6mR9CJc=
=sXTi
-----END PGP SIGNATURE-----



More information about the Digitalmars-d mailing list