property syntax strawman

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Aug 2 10:13:24 PDT 2009


Michiel Helvensteijn wrote:
> Andrei Alexandrescu wrote:
> 
>>> You should read my reply to myself, though. It describes an ambiguity in
>>> the approach. Several solutions are discussed. (Just translate them from
>>> grouping to non-grouping solutions.)
>> My reader does not show that message.
> 
> How strange.
> 
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=94712

Oh, I do see it. But that message predates your other message, the one I 
was replying too.

To summarize:

bool empty
{
     void set(auto value) { ... }
     bool get() { ... }
}

I would really really prefer to not have two scopes in there. It makes 
properties unduly arcane to define, particularly read-only properties. 
They should be about as easy to define as regular methods.

Then in a later message you mention:

bool empty.get() { ... }
void empty.set(bool b) { ... }

which I like and which does not seem to have difficulties; the names 
"get" and "set" will be never used as such.


Andrei



More information about the Digitalmars-d mailing list