Perfect forwarding

Jean-Louis Leroy jl at leroy.nyc
Thu Jul 30 02:32:46 UTC 2020


On Thursday, 30 July 2020 at 01:31:59 UTC, Manu wrote:

> Also, your solution doesn't perform any interesting 
> transformation on
> args... forwarding functions usually transform some 
> argument(/s) in some
> way, or inject additional arguments.

I struggled with that in openmethods where transformations do 
occur, and that's why I created this thingy: 
https://github.com/aliak00/bolts/blob/master/source/bolts/experimental/refraction.d, which allows you to create a function from a function, while manipulating its "aspects" in any way you want.

But yeah it's just a saner way of building a string mixin, and 
annoyingly, they are almost inevitable...just creating a function 
with anything but a fixed name requires a string mixin afaik..

Andrei's challenge and Adam's variation are among the simplest 
cases because the storage classes and function attributes can be 
inferred from the wrapped function. std.typecons.wrap, on the 
other hand, has to mess with function attributes.



More information about the Digitalmars-d mailing list