PhobosWatch: manifest => enum

"Jérôme M. Berger" jeberger at free.fr
Fri Dec 28 12:59:54 PST 2007


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

Walter Bright wrote:
> Jérôme M. Berger wrote:
>>     I agree that "const (int)" and "int" should be different types.
>> What I don't really see is why manifest constant need to be "int"
>> rather than "const (int)". After all, any attempt to use one as
>> non-const will fail (or should) so there's no real reason that they
>> can't be "const (int)", is there?
> 
> Since one cannot take the address of a manifest constant, the
> requirement that it be immutable goes away, since it can never be an
> lvalue.

	Right. Replace "const" by "invariant" in my comment and the main
point still stands: couldn't the compiler determine automatically if
we take the address of an invariant variable and allocate memory for
it or not based on that? This would remove the need for a special
keyword/syntax for manifest constants: just declare them as
"invariant" and let the compiler do the work.

		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)

iD4DBQFHdWPKd0kWM4JG3k8RAk2kAJ9PDwO5TsX2Sg7pkkVnCGcZP/ty0ACUDgdQ
6Qvm9osRRpRIXQ001Xk2Xw==
=92yB
-----END PGP SIGNATURE-----



More information about the Digitalmars-d mailing list