this post was submitted on 21 Oct 2024
199 points (99.0% liked)

Programming

17418 readers
193 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] zygo_histo_morpheus@programming.dev 31 points 3 weeks ago (11 children)

I'm a bit skeptical that a borrow checker in C++ can be as powerful as in rust, since C++ doesn't have lifetime annotations. Without lifetime annotations, you have to do a whole program analysis to get the equivalent checks which isn't even possible if you're e.g. loading dynamic libraries, and prohibitively slow otherwise. Without that you can only really do local analysis which is of course good but not that powerful.

Lifetime annotations in the type system is the right call, since it allows library authors to impose invariants related to ownership on their consumers. I doubt C++ will add it to their typesystem though.

[–] hunger@programming.dev 29 points 3 weeks ago (10 children)

Read the proposal: Lifetimes annotations, the rust standard library (incl. basic types like Vec, ARc, ...), first class tuples, pattern matching, destructive moves, unsafe, it is all in there.

The proposal is really to bolt on Rust to the side of C++, with all the compatibility problems that brings by necessity.

[–] Traister101@lemmy.today 10 points 3 weeks ago (7 children)

Gonna need to start calling it C++++ at this point. So much extra shit in the standard library

[–] hunger@programming.dev 1 points 3 weeks ago

Well, its a brand new standard library. A fresh start.

load more comments (6 replies)
load more comments (8 replies)
load more comments (8 replies)