timotheecour:
IMO, there's too little value in those ufcsWritef, ufcsWritefln,
ufcsWriteln, ufcsWritefln to justify adding them. When does it
stop??
I have opened this thread, instead of asking for those functions
in Bugzilla rightly because I don't know where it stops.
Why not introduce 'tap', which is more generic and has been
proposed before:
something like this:
T tap(alias fun,T)(T a){
fun(a);
return a;
}
Then:
auto result = data.dostuff.domorestuff.tap!(a=>
writef(fmt,a)).morestuff.finalstep;
of course for non-formatted write it's even simpler:
auto result =
data.dostuff.domorestuff.tap!writeln.morestuff.finalstep;
Because tap leads to a bit more verbose syntax, and because I've
seen that in most cases what I want to put in tap is a printing
:-)
That being said, I believe std.algorithm.reduce DOES deserve
it's counterpart with reversed arguments,
There is a patch and discussions on this in Bugzilla and GitHub.
So probably you will see a UFCS-friendly reduce.
Bye,
bearophile