any news on const/invariant?
Walter Bright
newshound1 at digitalmars.com
Tue Nov 27 09:55:20 PST 2007
Janice Caron wrote:
> Ah, but the natural interpretation of const(...) is that /everything/
> inside the brackets is const. Thus, if I write
>
> const(void f(char[] b))
>
> that "suggests" to me that b is const, since it is inside (albeit
> deeply inside) the const(...) brackets.
That's only if one thinks that const, when applied to a function, also
influences its return type. There is no reason why transitive const
should apply in this way.
> But I only want f's "this" to
> be const, not b. Perhaps this is a case where "const at the end"
> creates a more helpful mneumonic?
It leads to awful looking code when you have a lot of them to do.
More information about the Digitalmars-d
mailing list