←back to thread

196 points svlasov | 1 comments | | HN request time: 0.235s | source
Show context
Dwedit ◴[] No.40851285[source]
Compile time or runtime? Compile time reflection would be completely painless and bloat-free.
replies(3): >>40851300 #>>40851330 #>>40851736 #
shortrounddev2 ◴[] No.40851330[source]
RTTI is a super vital feature for deserializing without having to generate code or write a ton of tedious boilerplate. I'd be very happy with RTTI in C++ and my life would be instantly easier if there were RTTI in typescript so I didn't have to use any of the hacky solutions out there for deserializing JSON on backends without RTTI.

I suppose C++'s template system might be able to generate JSON deserializers with static reflection as well

replies(2): >>40851369 #>>40851644 #
1. comex ◴[] No.40851644[source]
> I suppose C++'s template system might be able to generate JSON deserializers with static reflection as well

It definitely can, and it will be faster and more type-safe than doing it at runtime. But if you do want to do it at runtime, well, it's possible to implement runtime reflection as a library on top of compile-time reflection, so someone will probably do that.