Suggestion for a new trait: __traits(getCaptures,...)

Adam D. Ruppe destructionator at
Tue Oct 22 16:53:42 UTC 2019

On Tuesday, 22 October 2019 at 16:42:36 UTC, Paul Backus wrote:
> Rather than a new `__traits`, it would also suffice to add a 
> `.captures` property to delegates. Then we could write the 
> following:

That won't work since the type system doesn't know delegate 
origins; whether it is a capture or an object or whatever is lost.

Though perhaps we could extend it... so the delegate's actual 
type DOES store this info, and then it implicitly casts back to 
the naked delegate we have today. That might be very interesting, 
then templates could possibly do by-value passes too.

More information about the Digitalmars-d mailing list