Hacker News new | ask | show | jobs
by b0sk 1547 days ago
it is very clunky though. there is no pattern matching support — you need to write non-trivial visitors to do any meaningful work and it takes the fun out of it. imo, Rust gets it right and borrows a lot of Haskell ergonomics
1 comments

It's easy to combine a list of per-type visitors, perhaps with an "auto" catch-all, into a single visitor for use with visit(), though. Not as fun as Haskell but a real improvement over C++14 and good enough for sum types in production C++.

See struct visitors in https://github.com/llvm/llvm-project/blob/main/flang/include...