new DIP5: Properties 2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jul 28 07:08:17 PDT 2009


Jarrett Billingsley wrote:
> On Mon, Jul 27, 2009 at 11:57 PM, Andrei
> Alexandrescu<SeeWebsiteForEmail at erdani.org> wrote:
> 
>>> 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.
> 
> Then on this we disagree ;)

I appreciate the asking.

>>> Or is the idea of introducing the 'property' keyword too controversial?
>> In this case the keyword isn't even the largest aggravation. The largest
>> aggravation is that everybody is with their hand on the syntactic holster
>> when they should look into simplifying and unifying, not adding more baroque
>> adornments for what is really some function calls.
> 
> Oh?  And what's the solution, then, if you don't like opGet/opSet and
> don't want to pull out your syntactic pistol?  The status quo?  I
> think the sheer volume of messages on this subject alone - not only on
> these last few threads but over a period of *years* - shows that many
> people aren't satisfied with it.

My perception is that there are a few vocal people. The protests have 
been historically against the stupid "writeln = 42" which we must get 
rid of.

I have a dream.

* Parameterless functions still can be called without "()". People will 
realize that it's a prejudice to believe that this impedes code 
understanding, and their eyes and wrists will thank them.

* The syntax "foo = bar" is rewritten into "foo(bar)" IF AND ONLY IF the 
expression "auto __x = foo, __x = bar" is compilable.

* The non-uniformity regarding parameterless functions returning 
parameterless functions is acknowledged but considered minor.

Yum.


Andrei



More information about the Digitalmars-d mailing list