Revised RFC on range design for D2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Sep 26 07:03:16 PDT 2008


Bruno Medeiros wrote:
> Sergey Gromov wrote:
>> In article <gbgpak$2q10$1 at digitalmars.com>, 
>> brunodomedeiros+spam at com.gmail says...
>>> Also, some more on important bike shed issues:
>>>      for (; !src.done; src.next)
>>>      {
>>>          tgt.put(src.head);
>>>      }
>>>
>>> As a matter of coding style conventions, I would say that using the 
>>> implicit property function call feature on a function that changes 
>>> state is *bad* style, and surely hope the community would agree on that.
>>> So "src.next" would be must better as "src.next()" as "src.next" 
>>> really just makes me cringe.
>>
>> I think that property function call feature in general adds an 
>> unnecessary ambiguity to the language.  I'd prefer functions to be 
>> callable only with regular function call syntax, and properties be 
>> usable only with member access syntax.  The same stands for 'unified 
>> function call' feature: if you want to inject a method into an 'array 
>> of chars' class you do so explicitly, and only the member call syntax 
>> is allowed on that method.  Otherwise code tends to become ambiguous 
>> and unreadable.
> 
> Yes, I full agree, as many others do, as this has been discussed before 
> (the latest discussion: 
> http://www.digitalmars.com/d/archives/digitalmars/D/Omittable_parens_is_an_evil_73881.html) 
> 
> But that didn't seem to convince any of the higher-ups, so I was hopping 
> to at least have the feature used more sensibly (ie, not being used in 
> functions that are not intended to emulate properties).

Following that link I see there is a problem with accessing .mangleof. 
So the compiler sees a.b.mangleof and performs a.b().mangleof. I think 
that is a compiler bug because built-in properties like mangleof and 
sizeof should have priority over symbol evaluation.

Then I see a problem with new Thread(run). I think that is C++ habit at 
work.

Finally there's a discussion on how various language additions could 
work. I don't see how Walter could be convinced.


Andrei


More information about the Digitalmars-d-announce mailing list