@property

Kapps opantm2+spam at gmail.com
Sun Aug 5 14:32:19 PDT 2012


On Sunday, 5 August 2012 at 14:32:50 UTC, Adam D. Ruppe wrote:
> On Sunday, 5 August 2012 at 04:12:23 UTC, Jonathan M Davis 
> wrote:
>> I'd be very surprised if all that many people compile with 
>> -property.
>
> Indeed. Sometimes I try it just to see what happens, and always 
> the same results: it doesn't solve problems and complains about 
> code.
>
> Some examples of things that break:
>
> import std.algorithm;
> foreach(i; [1,2,3].map!"a+1") {
>
> }
> prophate.d(5): Error: not a property [1,2,3].map!("a+1")
>
>
> Of course, this is relatively new, using ufcs in 2.059, so the 
> breakage probably isn't too bad, but I'm not the only one who 
> writes it this way - I've seen a number of reddit and newsgroup 
> comments do this too, especially when chaining it.
> [snip]

I completely agree, particularl with the UFCS part. UFCS is 
designed to get rid of the horrible mess of (), and now we want 
to arbitrarily force a () anyways? Seems like it defeats the 
purpose. To me, when comparing
range.filter!"a > 2".map!"a*a".countUntil(3)
to
range.filter!"a > 2"().map!"a*a"().countUntil(3)
Those extra paranthesis just don't do anything, they don't give 
extra meaning, they don't accomplish anything useful but distract 
from the actual expression.

Most importantly though, with the focus on avoiding breaking 
code, why are we putting in -property which has the *sole* 
purpose of breaking existing code. And a whole lot of it at that. 
Never mind that a huge number of people strongly dislike the idea 
of enforcing paranthesis in the first place. It's not even about 
whether I agree with enforcing it, it's that I strongly disagree 
with breaking code for no benefit besides what some people will 
arbitrarily think is cleaner code, and others will not.


More information about the Digitalmars-d mailing list