News for hackers. Stuff that matters.
Re:Things I hate about Rust, redux by loeg on Thursday March 10, 2022 @11:15AM (#30628571)
Not sure I agree with this. The relative similarity between static and dynamic dispatch in C++ is pretty confusing (to me) (edit: as in, 'virtual' vs non-'virtual' methods).
Re:Things I hate about Rust, redux by chubot on Thursday March 10, 2022 @11:32AM (#30628785)
?? They appear completely different in C++, i.e. virtual functions vs. templates

https://eli.thegreenplace.net/2013/12/05/the-cost-of-dynamic...

I also wish they were more similar in both C++ and Rust. I find that most programs get more dynamic as they get bigger, get more usage, and get more extensible ... but the tendency is to want them to be as efficient as possible at the beginning.

Re:Things I hate about Rust, redux by loeg on Thursday March 10, 2022 @11:44AM (#30628946)
> They appear completely different in C++, i.e. virtual functions vs. templates

Virtual vs non-virtual functions.

Re:Things I hate about Rust, redux by chubot on Thursday March 10, 2022 @12:02PM (#30629242)
OK there is some static dispatch in regular functions with respect to argument overloading, e.g. f(int) and f(char), or obj.f(int) and obj.f(char).

But I think what is more commonly thought of as "static dispatch" is various template programming patterns, as in the blog post, which are more flexible, and has equivalents in Rust AFAIK.

Overall it does feel like there are too many similar mechanisms that look extremely different!

Re:Things I hate about Rust, redux by chlorion on Thursday March 10, 2022 @02:44PM (#30631497)
Would a regular non-virtual non-template method be considered single dispatch? I am pretty sure this is correct but I've never actually thought about this until I read your comment!
Re:Things I hate about Rust, redux by nickysielicki on Thursday March 10, 2022 @11:19AM (#30628625)
Oh, let’s not set the bar so low by comparing to C++. ;)

Two ends of the spectrum and I think the ideal is somewhere in the middle.