Skip to content

What can Rust's type/lifetime system do that Val can't? #788

Answered by kyouko-taiga
andrewjw1995 asked this question in Q&A
Discussion options

You must be logged in to vote

I've always been surprised by the common practice in Rust of giving lifetimes a single-letter name

To be fair, you can use any name you want. The single-letter practice is just a convention, like using T for most generic type parameters.

What I don't understand is how Val can distinguish between something being passed as 'inout' because you want to modify it, and something being passed as 'inout' because you want to alias it.

You never use inout to alias anything. In fact, you never use any passing convention to talk about aliasing. Val is all about independent values and lets you write programs as though references didn't exist.

For example, suppose you have a 'deserialize' method w…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@andrewjw1995
Comment options

@kyouko-taiga
Comment options

Answer selected by andrewjw1995
Comment options

You must be logged in to vote
4 replies
@kyouko-taiga
Comment options

@T4r4sB
Comment options

@T4r4sB
Comment options

@kyouko-taiga
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants