Comment by kjksf

Comment by kjksf 6 months ago

1 reply

I did use bind earlier in SumatraPDF.

There are 2 aspects to this: programmer ergonomics and other (size of code, speed of code, compilation speed, understandability).

Lambdas with variable capture converted to std::function have best ergonomics but at the cost of unnamed, compiler-generated functions that make crash reports hard to read.

My Func0 and Func1<T> approach has similar ergonomics to std::bind. Neither has the problem of potentially crashing in unnamed function but Func0/Func1<T> are better at other (smaller code, faster code, faster compilation).

It's about tradeoffs. I loved the ergonomics of callbacks in C# but I working within limitations of C++ I'm trying to find solutions with attributes important to me.

spacechild1 6 months ago

> but Func0/Func1<T> are better at other (smaller code, faster code, faster compilation).

I would really question your assumptions about code size, memory usage and runtime performance. See my other comments.