Email or username:

Password:

Forgot your password?
Top-level
Lore :v_enby:

@Mara I like this idea, helps with what feels like gymnastics in several situations. Especially helps as a learning opportunity on temporary lifetime extension to help demystify rust. A natural extension would be for function bodies to use "super let", so that `pin!` could be a [safe] function. I hit this problem much more often than the nested blocks in your exposition. Though that sounds like an advanced form of "placement" so there might be a lot wrapped into there. But it would be good to consider how this feature may evolve longer term such as for those use cases. Syntactically I think the use of "super" here is clever in a good way — an alternative syntax might involve explicit lifetimes but any options that come to my mind there feel needlessly verbose.

2 comments
Mara

@lorepozo Yes! Allowing `super let` at function level for functions that basically place additional values in the caller's stack frame would be useful! Then a function could create an object (in the caller's frame) and return something that references it, like a safe pin() would need to.

That would need to be part of the function _signature_ though. I don't think we should (or can) allow any regular fn to start placing extra objects into the parent's scope.

Mara

@lorepozo I've added a small aside about this to the blog post.

Go Up