Function calls

Steven Schveighoffer schveiguy at yahoo.com
Thu Jan 28 03:44:38 PST 2010


On Wed, 27 Jan 2010 15:54:42 -0500, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> downs wrote:
>> Adam D. Ruppe wrote:
>>> On Wed, Jan 27, 2010 at 06:34:57PM +0100, Pelle Månsson wrote:
>>>> I disagree, I find the function calls without the () to be really  
>>>> prettifying.
>>>>
>>>> But maybe that's just me.
>>>>
>>>> I don't think that it causes serious bugs, you would see that it's an  
>>>> integer the moment you try and use it. It also helps changing code  
>>>> from/to functions.
>>>>
>>>> I really like this feature, and would miss it should it go away.
>>> Me too.
>>>
>>  Me three.
>
> There was a long discussion about that, which prompted the addition of  
> @property. I was in the anti- at property camp, but had understanding and  
> sympathy for the ambiguity issues involved without @property.
>
> There was a vote in which as far as I recall the pro- at property camp was  
> beaten to a tender pulp.
>
> Now @property is in. That has created (as I had anticipated) the  
> unresolved issue of choosing between @property or just function for any  
> given parameterless function. Also I need to litter my code with  
> @property. To this day I am not sure whether we made the right decision.

1. Choosing between including @property or not is rare.  Most cases are  
obvious.  If you worked with a language that requires property notation  
(i.e. C#) this would not be as big an issue for you.

2. Defining @property on functions you wish to call as properties can be  
done all at once, enclosing all properties in a @property { } block.  No  
need to "litter" all your code with that.  Furthermore, function signature  
'documentation' is not as littering as you think.  Verbosity at definition  
is not as cumbersome as verbosity at the call site.  In other words, the  
extra litter at definition time pays huge dividends in clarity at the call  
site, and is not a constant annoyance (you only define things once).

I'm sure C developers who were used to omitting prototypes were equally  
miffed when it became required.

-Steve



More information about the Digitalmars-d mailing list