new DIP5: Properties 2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jul 28 06:54:39 PDT 2009


Kagamin wrote:
> Andrei Alexandrescu Wrote:
> 
>>> I know you said you didn't really like the idea of having to name
>>> your range's empty function 'opGet_empty'.
>> Correct. I'd rather try to disambiguate the rather rare case when a
>>  property returns a delegate etc. For me, I get a breath of fresh
>> air whenever I get to not write "()". I can't figure how some are
>> missing it.
> 
> It's agains C look and feel to call function without braces. It's not
> a problem to write code. It's a problem to read and understand it,
> isn't it? Isn't current programming techniques development aimed to
> ease maintenance?

Well there are quite a few other things that are arguably against C look 
and feel, such as the scope statement. I've never had a problem 
understanding code because of lacking "()", and I never ever write them.

>>> The property attribute also has the nice property (heh) that you
>>> can call the property setters and getters either as properties or
>>> as functions (i.e. "r.empty" or "r.empty()"). Basically, the
>>> behavior would be *exactly* as it is now, except you'd have to
>>> explicitly state with which functions it would be legal.
>> I guess I'd rather not have to specify that. I'd do that on all of
>> my functions that don't take parameters. To me that's syntactic
>> noise and an unnecessary special case.
> 
> r.empty returns an empty instance of a range (especially makes sense
> for dummy objects). r.empty() empties the range. It's not quite good
> if your code has such an ambiguity.

Actually r.empty() does not empty the range :o).

Andrei



More information about the Digitalmars-d mailing list