@property - take it behind the woodshed and shoot it?

Adam Wilson flyboynw at gmail.com
Thu Jan 24 13:24:15 PST 2013


On Thu, 24 Jan 2013 13:19:49 -0800, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> On Thursday, January 24, 2013 13:08:08 Adam Wilson wrote:
>> On Thu, 24 Jan 2013 12:58:41 -0800, Andrei Alexandrescu
>>
>> <SeeWebsiteForEmail at erdani.org> wrote:
>> > On 1/24/13 3:45 PM, Nick Sabalausky wrote:
>> >> On Thu, 24 Jan 2013 12:51:32 -0500
>> >> Andrei Alexandrescu<SeeWebsiteForEmail at erdani.org> wrote:
>> >> No, you merely came up with *some* specific cherry-picked examples  
>> that
>> >> sparked *some* debate (with most of the disagreing coming from
>> >> you).
>> >
>> > I simply mentioned three reasons that came to mind.
>> >
>> > Andrei
>>
>> While I don't approve of Mr. Sabalausky's tone or attitude,
>
> He does have a tendancy to get out of hand in that regard.
>
>> the crux of
>> his argument is logically sound. The problem with @property isn't
>> @property, it's D's insistence on optional parens. If paren usage was
>> clearly defined then this would be a non-issue. I would like to point  
>> out
>> that I can't think of another systems/general purpose language that has  
>> an
>> calling syntax specification as vague and convoluted as D's. C#'s is
>> brutally simple. Java's is brutally simple. In C/C++ everything is a
>> function or field, so, brutally simple.
>>
>> Make D's calling syntax simpler, end optional parens!
>
> Exactly. That's what _should_ have happened. We wouldn't have all of  
> these
> problems if we'd just gone with a C#-esque property design and never had
> optional parens. Unfortunately however, optional parens are so popular  
> for at
> least some use cases (e.g. UFCS), that I don't think that there's much  
> chance
> of them going away.
>
> - Jonathan M Davis

All I can say is that in this case even with UFCS C# enforces parens  
because it's syntactically clear. Yes, it might be slightly annoying to  
have to type the (), but that's how you define a function in every other  
language. A shortcut with side-effects isn't a short-cut, it's a bug  
factory. And to be honest, once the language spec settles down tools like  
ReSharper/VisualAssist/etc. can take care of the extra parens. I hand type  
a small fraction of the parens that actually appear in my C# code.

-- 
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


More information about the Digitalmars-d mailing list