Make dur a property?

Timon Gehr timon.gehr at gmx.ch
Wed Jan 23 15:45:02 PST 2013


On 01/23/2013 11:46 PM, Nick Sabalausky wrote:
> On Wed, 23 Jan 2013 21:29:14 +0100
> Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:
>
>> On 1/23/13, Adam D. Ruppe <destructionator at gmail.com> wrote:
>>> On Wednesday, 23 January 2013 at 17:13:05 UTC, Timon Gehr wrote:
>>> Amen! -property MUST die. @property should fix the real problems
>>> with properties, not leave that broken while adding new problems.
>>
>> About @property problems, I've recently ran into this:
>> ModuleInfo.unitTest is defined as
>>
>> @property void function() unitTest() nothrow pure;
>>
>> And if I use it:
>>
>>      foreach (m; ModuleInfo)
>>      {
>>          if (m is null)
>>              continue;
>>
>>          if (auto fp = m.unitTest)
>>          {
>>              fp();           // calls it
>>              m.unitTest();   // doesn't call it
>>              m.unitTest()(); // calls it
>>          }
>>      }
>>
>> This is regardless of the -property switch. I would expect the second
>> call to work. Anyone know if this is filed already?
>
> Don't know if it's filed, but yea: Optional empty-parens and
> the practice of conflating properties with functions is riddled with
> corner-cases. We can either try to patch over these corner cases
> with increasingly detailed new rules,

What are those "new" rules? The rules we already have are sufficient. 
Now the compiler needs to implement them properly.

> as Andrei is proposing, or we
> can just accept "the writing on the wall" (if you'll pardon my 80's-ism)
> that properties != functions.
>

That is not even the point of this discussion.

a.map!(a=>foo(a,b).map!(a=>2*a)())().days().ago().writeln()



More information about the Digitalmars-d mailing list