On Sunday, 18 October 2015 at 21:18:52 UTC, rcorre wrote:
On Sunday, 18 October 2015 at 21:00:32 UTC, Meta wrote:
On Sunday, 18 October 2015 at 19:00:16 UTC, rcorre wrote:
You might find this interesting. It's an "outside-in" approach to the same problem as opposed to your "inside-out" approach. Not finished, but the general idea is there.

https://github.com/MetaLang/phobos/commit/c8132f53b791ed4a134dd456c8fd20d0d201731d

That's just the kind of thing I was looking for! I actually started with a 'visitor' function that works similar to project:

https://github.com/rcorre/superstruct/blob/master/src/superstruct.d#L153-L166

then decided to wrap the whole thing in a struct to expose the members more 'naturally'.

I think having something like project in phobos would be pretty useful though.

And at the risk of going a little overboard, I think the answer to supporting arbitrary templated functions is to wrap visitor/project itself in a template, that then returns a variadic function while passing along other compile-time args. Maybe. I haven't thought it through too carefully...




Reply via email to