Just sharing from r/rust

TankieReplyBot
bot account
link
fedilink
12Y

A Twitter link was detected in your post. Here are links to the same location on Nitter, which is a Twitter frontend that protects your privacy.

TankieReplyBot
bot account
link
fedilink
12Y

A Twitter link was detected in your post. Here are links to the same location on Nitter, which is a Twitter frontend that protects your privacy.

TankieReplyBot
bot account
link
fedilink
12Y

A Twitter link was detected in your post. Here are links to the same location on Nitter, which is a Twitter frontend that protects your privacy.

Tin Švagelj
link
fedilink
22Y

@kixik Inheritance can always be substituted by composition which is what #Rust does pretty well. Constexpr isn’t on C++ level, but I guess you can generate code from build script so there’s ways around it.
As for virtual functions - Traits are effectively to virtual function lookup table declarations that get used by dyn SomeTrait type. So calling a fn on Box\<dyn T\> generates VMT lookup.

Tin Švagelj
link
fedilink
22Y

@kixik Thanks to good macro system Rust can (via enum_dispatch) transform those lookups into a switch statement which is best of both worlds IMO.

Oh please not. Spare us from the C++ type-polymorphy nightmare. Traits are so much better than inheritance.

Rust Programming
!rust@lemmy.ml
    • 0 users online
    • 7 users / day
    • 8 users / week
    • 21 users / month
    • 56 users / 6 months
    • 1 subscriber
    • 269 Posts
    • 757 Comments
    • Modlog