On Thursday, 18 February 2021 at 15:11:44 UTC, Paul Backus wrote:
On Thursday, 18 February 2021 at 14:51:09 UTC, vitamin wrote:
On Thursday, 18 February 2021 at 14:43:43 UTC, Paul Backus wrote:

I don't see what this buys you compared to sticking with one or the other, but you are correct that it is technically possible.

It infer function atributes (pure, nothrow @nogc @safe) for "visitor" and let you use classes and inheritence. With standard visitor pattern you need PureVisitor. NothrowVisitor, PureNothrowVisitor...

It seems to me like you would also get those benefits by just using a discriminated union, without the classes.

Yes, but classes has nice things like abstract/override/final methods and covariant return types and almost everybody known how they works. Maybe this things can be simulated with templates.

Reply via email to