IMO, there's too little value in those ufcsWritef, ufcsWritefln,
ufcsWriteln, ufcsWritefln to justify adding them. When does it stop??

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;


--------

That being said, I believe std.algorithm.reduce DOES deserve it's
counterpart with reversed arguments, more UFCS friendly (which we
could call fold or reduce2), as this is a more common pattern and
std.algorithm.reduce was a design mistake (before ufcs existed).

Reply via email to