The type inference provided by typeof(a) I think should be unnecessary. In fact, it's on the fringe of incoherency and it's meaning is a lot less than obvious.
I have to ask, what's the difference between a const view into an immutable value, and a const view into an invariant value? Nothing right...so since you can't modify data from a const view of the data, and an invariant is a thing that can't be modified, shouldn't you be able to seamlessly promote an invariant to const, with no side effects?
Cheers,
Scott S. McCoy
On Fri, 2008-03-28 at 18:31 -0700, Walter Bright wrote:
typeof(a) foo(const(T) a) { ... }