Auto-invariance (WAS: const )
Sean Kelly
sean at invisibleduck.org
Fri Mar 28 13:22:12 PDT 2008
== Quote from Janice Caron (caron800 at googlemail.com)'s article
> On 28/03/2008, Sean Kelly <sean at invisibleduck.org> wrote:
> > Here, the need to create separate, identical implementations for the same
> > algorithm that vary only by the constancy of buf simply so the compiler can
> > optimize differently for each aspect is horrible.
> Stephen addressed that very problem in the thread "const debacle". He
> came up with a solution, which I later simplified. It's probably not
> something that will happen any time soon, but just to let you know, it
> has been thought about, and a solution proposed.
> > I would much rather have
> > the compiler invisibly generate the different permutations for me and do
> > something fancy with the name mangling to sort out all out invisibly. So:
> >
> > "abc".find( 'b' ); // calls the "invariant(char)[]" permutation
> > char[] buf; buf.find( 'b' ); // calls the "const(char)[]" permutation
> Yep, that's what we solved. :-)
Nice to know I'm not the only one that feels this way :-)
Sean
More information about the Digitalmars-d
mailing list