Revised RFC on range design for D2

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


KennyTM~ wrote:
> Andrei Alexandrescu wrote:
>> Bruno Medeiros wrote:
>>> 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.
>>
>> I sure hope they won't agree to an unsupported assertion.
>>
> 
> Actually I *do* hate this "feature" ^_^.
> 
> And this "feature" has been put to challenged before:
>  * Bug 2159. (http://d.puremagic.com/issues/show_bug.cgi?id=2159)
>  * "Omitting Parens is an Evil" 
> (http://www.digitalmars.com/d/archives/digitalmars/D/Omittable_parens_is_an_evil_73881.html) 
> 
> *http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=D&artnum=17579 
> 
> But nothing got changed.

I don't think the bug report has much strength.

> To the very least, when using next as a property I assume the call won't 
> produce any secondary effect on src from the syntax, since I'm just 
> reading a state! Not so if one calls src.next() as the "()" is an 
> alarming sign that src _may_ change afterwards. This could is just a 
> problem of personal taste since the compiler does not forbid src.next(), 
> but not so if you're reading other's code.
> 
> P.S. If src.next() is too lengthy, why not just adopt ++src?

Because people (in wake of the recently introduced array operations) may 
legitimately expect that to mean "increment all elements of src".


Andrei


More information about the Digitalmars-d-announce mailing list