transporting qualifier from parameter to the return value
Kagamin
spam at here.lot
Wed Dec 16 04:57:28 PST 2009
Michel Fortin Wrote:
> class Test {
> void doThat() immutable {}
> void doThat() const {}
> void doThat() {}
> void doThat() shared immutable {}
> void doThat() shared const {}
> void doThat() shared {}
>
> void doSomething() inout // or vconst
> {
> doThat(); // which doThat does it call?
> }
> }
Const function will be called. I replied about sharing in another post.
> class Test {
> void doThat() immutable {}
> void doThat() shared immutable {}
>
> void doSomething() inout // or vconst
> {
> doThat(); // which doThat does it call?
> }
> }
It's a compile-time error: vconst is orthogonal to immutable, so you can't pass vconst(this) as immutable(this). Immutable methods are callable only on immutable data. Period.
More information about the Digitalmars-d
mailing list