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

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


On Thu, 24 Jan 2013 16:29:24 -0800, Timon Gehr <timon.gehr at gmx.ch> wrote:

> On 01/25/2013 01:12 AM, Andrei Alexandrescu wrote:
>> On 1/24/13 6:52 PM, Adam Wilson wrote:
>>> On Thu, 24 Jan 2013 00:34:42 -0800, Walter Bright
>>> <newshound2 at digitalmars.com> wrote:
>>>
>>>> This has turned into a monster. We've taken 2 or 3 wrong turns
>>>> somewhere.
>>>>
>>>> Perhaps we should revert to a simple set of rules.
>>>>
>>>> 1. Empty parens are optional. If there is an ambiguity with the return
>>>> value taking (), the () go on the return value.
>>>>
>>>> 2. the:
>>>> f = g
>>>> rewrite to:
>>>> f(g)
>>>> only happens if f is a function that only has overloads for () and
>>>> (one argument). No variadics.
>>>>
>>>> 3. Parens are required for calling delegates or function pointers.
>>>>
>>>> 4. No more @property.
>>>
>>> I just worked through this with Alexander Bothe (of Mono-D fame). Here
>>> is what C# does.
>>>
>>> public Action temp { get; set; }
>>> public Action Event { get { return temp; } }
>>> t.Event; //returns the delegate
>>> t.Event(); //calls the delegate.
>>>
>>> Simple, clean, clear, concise. No problems with optional parens.
>>>
>>> (Action is a delegate in C#)
>>
>> This looks essentially the same as Walter's proposal.
>>
>> Andrei
>
> Not at all. Walter's proposal just chooses the other option when stuff  
> is "ambiguous" and adds a hideous special rule in case the empty  
> argument list was obtained from an empty sequence.

Basically this. I was writing a longer post that essentially said this.

Also non-logical special case rules like this make the language harder to  
learn, therefore harder to evangelize.

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


More information about the Digitalmars-d mailing list