PhobosWatch: manifest => enum
Janice Caron
caron800 at googlemail.com
Sun Dec 30 01:00:28 PST 2007
On 12/30/07, "Jérôme M. Berger" <jeberger at free.fr> wrote:
> int x = 42;
> const auto y = x; // y is now "const int"
The word "auto" is redundant here.
int x = 42;
const y = x;
> (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.
More information about the Digitalmars-d
mailing list