chandlerc, to llvm
@chandlerc@hachyderm.io avatar
blinkygal, to cpp

Swift is getting really mature. Stable ABI. Using clang to access and represent C++ types natively. No ffi bindings required. Foundation library available on all desktop platforms.

I hope Rust will start putting some serious effort behind C++ migration/interop. Or I can see a future where the C++ industry migrates largely to Swift, with perhaps Rust libraries for specific tasks like codecs. Which is fine but I worry about some companies, that would be willing to use Rust, never catching up to that.

C++ code will never migrate directly into Safe Rust. Swift found a middle ground for it that Rust will need too. Unsafe Rust needs to become a language people can do their daily work in that is better than C++. That’s what migration can look like.

I was skeptical of Carbon’s plan to build out an unsafe language that is good to work in, since I felt like the safe language is where people should be. I still worry about coming in and building the safe language later, but I can see the value of making an ergonomic unsafe language (nullability for pointers for example), because they are taking seriously the idea of migrating whole C++ codebases to this language. AND understanding that people will be working in that (unsafe) language full time.

1/2

blinkygal,

An unsafe Rust can still solve a ton of safety problems, leaving lifetimes to mitigations like smart pointers (like raw_ptr in Chrome). This seems like the viable incremental migration/adoption strategy for Safe Rust. Swift is nailing this. I think Carbon is trying to go this direction too.

Anyway, enjoy an interesting chat with the Swift team manager:

https://mastodon.social/

2/2

uliwitness, to cpp
@uliwitness@chaos.social avatar

Reminder:

int& myFunc();

auto myVar = myFunc();

in C++ makes myVar an int variable, not an int&. You have to write

auto& myVar = myFunc();

to get the result you'd expect. I guess they didn't want to add new syntax for turning a reference into a non-reference.

uliwitness,
@uliwitness@chaos.social avatar

Does anyone know how references in Carbon work? All articles I find don’t go in-depth enough to even use references. Do you still have to use auto& to not strip off the reference-ness?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • thenastyranch
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • ngwrru68w68
  • provamag3
  • magazineikmin
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • JUstTest
  • All magazines