Stepping back and looking at constness from another angle.

Regan Heath regan at netmail.co.nz
Fri Jun 8 10:11:09 PDT 2007


Leandro Lucarella Wrote:
> Walter Bright, el  7 de junio a las 13:18 me escribiste:
> > Leandro Lucarella wrote:
> > >Carlos Santander, el  5 de junio a las 21:15 me escribiste:
> > >>invariant(char)[new] ret = "prefix";
> > >Syntax is getting so obscure... I'm scared.
> > 
> > Think of invariant(type) this way: imagine a template that creates a pointer to its type argument:
> 
> I _understand_ the syntax, but it's getting really hard to read the code
> (and D used to be a very clean language to read, not like C++). I
> undestand C++ syntax too, but I think it's way to far from the ideal ;)
> 
> I can't think of a better syntax though, but I just had to say it, I'm a
> little concerned of how much readabilty D could loose with this.

Yet another reason for const by default with implicit 'in'.  The source stays 'clean' but still provides the protection.

Regan



More information about the Digitalmars-d mailing list