← Back to context

Comment by cogman10

8 hours ago

Depends on the change being made.

If they completely replace an API then sure, probably.

But for most changes, like adding a param to a function or a struct, they basically have to learn nothing.

Rust isn't unlike C either. You can write a lot of it in a pretty C like fashion.

>"Rust isn't unlike C either. You can write a lot of it in a pretty C like fashion."

I think that with all of the Rust's borrowing rules the statement is very iffy.

  • C has a lot of the same borrowing rules, though, with some differences around strict aliasing versus the shared/exclusive difference in Rust.

    Most of the things people stub their toe on in Rust coming from C are already UB in C.

  • Rust's borrowing rules might force you to make different architecture choices than you would with C. But that's not what I was thinking about.

    For a given rust function, where you might expect a C programmer to need to interact due to a change in the the C code, most of the lifetime rules will have already been hammered out before the needed updates to the rust code. It's possible, but unlikely, that the C programmer is going to need to significantly change what is being allocated and how.

    • Not talking allocations, more like actual borrowing, aliasing, passing as parameters.