Remix.run Logo
▲ adev_ a day ago

> it's an alternative way to solve the problem presented

No it's not and you apparently did not understand the concept behind it (or more likely, do not want to understand the concept behind it).

Your solution is not an implementation of Open Polymorphism, it is just a poor man implementation of std::variant.

> Which the version I showed has none of.

Because it is not the same thing like explain by my previous comment and in around 5 other comments around mine soon I guess.

But you are entirely free to grunt around and continue to imply that C++ committee people are implementing something useless (Which they are not, this is useful).

▲nananana9 a day ago | parent [-]

My point is that you don't need open polymorphism for the example given, and if you give me another example, I can show you why you don't need it there either -- because you do in fact never need it. It's an XY problem over the set X.

If a programmer is reaching for a library, they want it to solve a concrete task. Nobody wants to subclass your Event type, if I have to do it, you've failed at your job.

▲adev_ a day ago | parent [-]

> Nobody wants to subclass your Event type, if I have to do it, you've failed at your job.

Because it's well known that subclassing is used only for Event type and never EVER anything else requires polymorphism #irony.

The only part of this discussion where you are right is that closed polymorphism (std:: variant) is better than open polymorphism when it can be applied.

And even there, your proposed implementation is utter garbage that leaks memory and that I would refuse straight away in any PR.