Using exceptions in C++ desktop and server applications overall made sense to me. As I expanded my usage of C++ into other domains, specifically embedded domains, I began to experience more compelling reasons not to use exceptions first-hand…

From lobste.rs

  • qwertyasdef@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    1 year ago

    At a library level, couldn’t you have an opaque sum type where the only thing you can do with it is call a match method that requires a function pointer for each possible variant of the sum type? It’d be pretty cursed to use but at least it wouldn’t require compiler plugins.

    • colonial@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      I’d bet five bucks some desperate Haskeller or Rustacean has implemented exactly that. You could also probably use nested functions for GCC C or lambdas in C++ to move everything inline?