[phobos] is*Range + Qualified Types

Shin Fujishiro rsinfu at gmail.com
Thu Aug 12 08:51:55 PDT 2010


Steve Schveighoffer <schveiguy at yahoo.com> wrote:
> I agree with Andrei we need a language solution.  The question really is not 
> what the solution should do, that much is clear -- apply const to a subset of 
> the members (either all references or members designated by some identifier).  
> The question is, what does the syntax look like.  That was the major stumbling 
> block that flipped Walter's switch to "tail-const doesn't work".

I can think of a similar syntax as the inout for functions:

wild struct Range
{
    wild(Node)* cur;
    @property wild(V) front() wild { return cur.value; }
    void popFront() wild { cur = cur.next; }
    @property bool empty() wild { return next !is null; }
}

This wouldn't work with nested structs though.


Shin


More information about the phobos mailing list