|
|
Subscribe / Log in / New account

Supporting Rust is inevitable for platforms that want to remain viable for modern software releases

Supporting Rust is inevitable for platforms that want to remain viable for modern software releases

Posted Nov 25, 2024 18:48 UTC (Mon) by khim (subscriber, #9252)
In reply to: Supporting Rust is inevitable for platforms that want to remain viable for modern software releases by pbonzini
Parent article: NonStop discussion around adding Rust to Git

> Is anybody using reflexpr in production?

I don't know. It's not yet available in a stable form, anyway.

But with C++20 you already have pretty decent reflection: could count number of fields in a struct (here's an explanation about how that could be achieved), enumerate enums, deal with various pointers to functions, etc.

But the most useful ability is simple std::is_same_v, which allows you to look on the type and do something special for one type or another. Incredibly useful in so many places when combined with if constexpr. And incredibly awkward in Rust.

> For Rust, serde provides serialization and deserialization that satisfies a lot of the usecases for reflection.

Sure, but that requires the maker of these types to think about that need. There are also #test which solves another issue that many other languages handle via reflection.

This covers around 90% of usecases and actually make Rust tolerable, sure.

But the remaining 10% of usecases still exist.


to post comments

Supporting Rust is inevitable for platforms that want to remain viable for modern software releases

Posted Dec 5, 2024 21:53 UTC (Thu) by ssokolow (guest, #94568) [Link]

Sure, but that requires the maker of these types to think about that need.
That depends on what you mean by "think about that type of need".

Serde does have a workaround for "remote types" and, beyond that, you're bumping up against intentional Rust design decisions relating to API stability.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds