Make dur a property?

Timon Gehr timon.gehr at gmx.ch
Thu Jan 24 03:02:05 PST 2013


On 01/24/2013 04:02 AM, Nick Sabalausky wrote:
> On Thu, 24 Jan 2013 00:45:02 +0100
> Timon Gehr <timon.gehr at gmx.ch> wrote:
>
>> On 01/23/2013 11:46 PM, Nick Sabalausky wrote:
>>> On Wed, 23 Jan 2013 21:29:14 +0100
>>> ...
>>> 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.
>>
>
> Andrei was just suggesting this:
>
> http://forum.dlang.org/post/kdpg5n$2qt2$1@digitalmars.com
>

This rule is not new. Also, it is about @property.

>>> 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()
>>
>
> First of all, spacing helps:
>

I do not see that. It just blows up the code even more.

> a.map!( a => foo(a,b).map!(a=>2*a)() )().days().ago().writeln()
>
> So does not trying to cram everything into a one-liner:
>
> auto descriptiveName = a => foo(a,b).map!(a=>2*a)();
> a.map!descriptiveName().days().ago().writeln()
>

This is not valid code.

> And then there's a few () in there, but not only do I fail to see how
> those hurt anybody, they make perfect sense since "days", "ago" and
> "writeln" are not data access, they're actions (even if maybe a little
> too cutely-named in the case of "ago").
>

There is no universal rule that says () has any relevance for this.

(Arguably, it does not make any sense to distinguish concepts like 'data 
access' and 'action' syntactically. What is this distinction anyway?)

> (Of course, I'd question the meaningfulness and feasability of passing
> the "days" type constructor a range instead of a scalar, but I get that
> that's beside the point ;) )
>

No, that is spot on. I didn't even notice, which is partly owed to the 
paren spam.





More information about the Digitalmars-d mailing list