Too many attributes?

Bruno Medeiros brunodomedeiros+spam at com.gmail
Tue Apr 29 18:23:42 PDT 2008


Janice Caron wrote:
> On 29/04/2008, Bruno Medeiros <brunodomedeiros+spam at com.gmail> wrote:
>> Another example why "scoped const", despite "only" being a syntactical
>> convenience, might be so important.
> 
> That wouldn't help in this case. The reason you need the second
> declaration is so that one declaration can be pure, the other not.
> Steven's proposal solves a different problem.

Not if you combine "scoped const" with the partially pure function rules 
(see new thread). Example:

   //(using 'anyconst' as the scoped const keyword)

   class Object
   {
     pure anyconst bool opEquals(anyconst(Object) obj) {...}


The 3 versions of opEquals would be created. 2 of them would partially 
pure, the other (the invariant one) would be fully pure. The mutable 
version would be redudant though.

This would work, but since there is redundancy, I'm thinking there could 
be a better way to do it.


-- 
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list