PhobosWatch: manifest => enum

"Jérôme M. Berger" jeberger at free.fr
Mon Dec 31 02:05:05 PST 2007


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

Janice Caron wrote:
> On 12/30/07, "Jérôme M. Berger" <jeberger at free.fr> wrote:
>> (1) It would be even nicer if the compiler could keep track of
>> whether there are *mutable* pointers in the struct <snip>
> 
> I'm in favor of handing responsibility for that decision to the programmer.
> 
>     const T x = whatever;
>     auto y = x.dup;
> 
> Then it becomes the programmer's responsibility to implement dup for
> each type T.
> 
> .dup is already built into arrays. It would be trivial for Walter to
> supply a dup() function for primative types (dup()ing a const(int)
> must yield an int result). For structs and classes, it becomes the
> programmer's problem.
> 
> I /think/ this will work, and it will definitely work better than
> making poor "auto" do different things for each type.
> 
	Well, the whole point of having an "auto" keyword is that it should
do the right thing automagically. After all, it says so in the name!

	Moreover, this would allow "automatic manifest constants" to work
(which was the main idea behind the suggestion: I was looking for a
solution that would allow manifest constants to be of type "const
int" instead of just "int").

		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)

iD8DBQFHeL7Rd0kWM4JG3k8RAjskAJ44IRFUSZtBTnGEoiM8BgAvyFnKiACeICyB
C10W7/hE0Yq5JrfIiWW3FeI=
=t+QJ
-----END PGP SIGNATURE-----



More information about the Digitalmars-d mailing list