▲ | lock1 3 days ago | |
And OOP is just subtyping and visibility modifiers too! /j The main problem with ADT is language support for them. Primarily sum types, as they're missing in a lot of major PLs, while product types are "just" structs or classes. Without language support, you can simulate them via brittle workarounds like `if (d.isTypeA()) return d.methodA()`. Actually, I agree, it is mundane. That's exactly why it's kind of becoming an itch for anyone used to ADT, you'll feel like you're missing a basic building block. Just imagine if all languages removed `struct`-like and `class`-like construct. Something like Brainfuck esolang or any plain asm. It certainly possible to create arbitrary complex program in those languages. But would you pick `struct`-less language over language that supports it natively? |