The amazing template which does nothing

Andrea Fontana via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 28 03:34:43 PDT 2015


On Tuesday, 28 April 2015 at 10:07:43 UTC, Andrea Fontana wrote:
> On Tuesday, 28 April 2015 at 09:23:53 UTC, Chris wrote:
>> And this has happened to me many times. The solution "Break 
>> the UFCS chain and use a local temporary variable" makes me 
>> angry, because by having to do so all the beauty of chaining 
>> is lost.
>
> A very slow (i guess) workaround could be:
>
> "test".toUpper.only.map!(a => "This is a " ~ a).front.writeln;
>
> vs the new one:
>
> "test".toUpper.Identity!(a => "This is a " ~ a).writeln;

Using std.functional:

"test".toUpper.unaryFun!(a => "This is a " ~ a).writeln;


More information about the Digitalmars-d mailing list