Blog Post: Beating std::visit Without Really Trying

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Mon Oct 7 08:07:01 UTC 2019


On Monday, 7 October 2019 at 01:38:04 UTC, Paul Backus wrote:
> Just to clarify: SumType isn't, and was never intended to be, a 
> drop-in replacement for Algebraic. Their interfaces are similar 
> enough that porting code from Algebraic to SumType shouldn't be 
> too difficult, but even within the common subset, there are 
> incompatibilities. For example, here's a post from an old 
> sumtype announcement thread where I discuss the differences 
> between SumType's `match` and Algebraic's `visit`:
>
> https://forum.dlang.org/post/xipgrrfljdnyhrhnmsij@forum.dlang.org

I don't follow. The visit and match template signatures are 
identical, and from what you describe the SumType match 
implementation should support the same handler choices as visit, 
while allowing extra/more flexible choices.

Where's the breaking change? Are there selections of handlers 
that work for visit and don't work with match?




More information about the Digitalmars-d-announce mailing list