Top 5

Steven Schveighoffer schveiguy at yahoo.com
Thu Oct 9 09:48:37 PDT 2008


"Andrei Alexandrescu" wrote
> Sergey Gromov wrote:
>> 2.  Drop the "call a function however you want" idea.  Simple property 
>> method syntax is nice, but excessive freedom is not.  Adding one simple 
>> keyword fixes the situation.  See
>>> http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.announce&artnum=13471
>> for an explanation.
>>
>> It'll probably break lots of regular code.
>
> This would be an uphill battle with Walter. He'd like to implement the 
> property calls to work only for pairs of functions, something discussed 
> here before.

Might I ask the reasoning behind the hilliness of the battle?  You can look 
at a formal property syntax exactly as pairing (or grouping) functions 
together:

int x
{
  get() { return _x;}
  set(int y) {return _x = y;}
  set(string s) {return _x = to!(int)(s);}
}

Note, int return type implied on every function as x is an int.  Also note 
that get/set do not need to be keywords.

What am I doing here?  Grouping related functions together...  Isn't this 
what Walter is looking for?

Walter's primary objection I would be most interested in.  I think this is 
one item that has been on a fair amount of top-5 posts in this thread, it 
could be because of the recent thread about it, it's fresh in everyone's 
mind, but it could also be because people really do want this feature.

-Steve 





More information about the Digitalmars-d mailing list