Do we want functions to act as properties, or merely omit parens for ufcs/chaining?

Michael pr at m1xa.com
Tue Jan 29 12:30:53 PST 2013


On Tuesday, 29 January 2013 at 19:36:50 UTC, Minas Mina wrote:
> My opinion is to allow calling a function without parentheses 
> only in UFCS (properties must be called without). Is that so 
> hard to implement?

+1, and workaround:

@property I Do(alias fun, I)(I o)
{
     return o is null ? null : (fun(o), o);
}

foreach(p; persons)
         p.Do!(a => a.address.cityName.write());


and add -property option to compiler args.


More information about the Digitalmars-d mailing list