Live data from Hacker News

Show HN: Beautiful Type Erasure with C++26 Reflection

ryanjk5.github.io

61–64 of 64 posts

Re: Show HN: Beautiful Type Erasure with C++26 Reflection

#61
post #46

I use C++ every day and this feels like an entirely different language and philosophy. I know this is the reality of C++, but I never go searching for it so when it pops up randomly my jaw drops a little.

I last used C++ in 1999 and modern C++ seems like a different language.

Re: Show HN: Beautiful Type Erasure with C++26 Reflection

#63
post #20
post #18

Earlier quoted context omitted.

> I would consider it beautiful. If there's something that C++ actually lacks, that's the elegance, grace and beauty. The rest, it's all already there or will be there shortly :)

The problem with that is best described by Antoine de Sain-Exupery's saying "perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." I guess the same goes for elegance and grace...

That's the thing though isn't it. C++ didn't add type erasure to the language, it added compile time reflection and said have at it.

Re: Show HN: Beautiful Type Erasure with C++26 Reflection

#64
post #43

> If you’ve ever tried using type erasure for something more complicated than std::any or std::function, you’ve either written 100+ lines of easy-to-mess-up code or reached for a boilerplate-heavy library like Boost.TypeErasure or Folly.Poly Or you just used void* and went on with your life

And lost value semantics and any hope of type safety.
Post reply on HN