PhobosWatch: manifest => enum

Walter Bright newshound1 at digitalmars.com
Fri Dec 28 12:30:07 PST 2007


Janice Caron wrote:
> On 12/28/07, Walter Bright <newshound1 at digitalmars.com> wrote:
>> and one is drawn
>> inevitably to conclude that const(T) is always a different type from T.
> 
> I don't think anyone's arguing with that. We're just saying that the
> behavior of auto x = could be tweaked to drop the head constancy.

Yes, but then other things break.


> It's the same with passing things to functions.
> 
>     void f(int x) { /*...*/ }
>     f(DAYS_IN_WEEK);
> 
> we want this to compile, right? Even though DAYS_IN_WEEK is likely to
> have type invariant(uint).

It isn't hard to make invariant(uint) implicitly convertible to uint, so 
that can work.

> You should always be allowed to create a
> mutable copy (though which preserves tail constancy).

There is no way to do this - unless you can come up with a way to 
declare tail const member functions in a reasonable way. I failed to 
solved this problem.



More information about the Digitalmars-d mailing list