Email or username:

Password:

Forgot your password?
Top-level
Tavian Barnes

@Mara How horrible would it be to infer this rather than require it to be written out?

3 comments
Mara

@tavianator To silently extend the lifetime of a `let` whenever necessary? I think that would result in the compiler silently accepting lots of code that shouldn't compile, hiding bugs and causing subtle unintended behavior. I don't think that's a good idea. ^^'

nyctef

@Mara @tavianator One worry I have (as a novice rust programmer who relies heavily on the very helpful error messages) is that if the compiler tells me "help: try using super let" then I'm probably going to press the "make my code compile" button without understanding the edge cases or consequences involved. So it may still cause some of these issues in practice?

(thanks for the blog post - it was a really interesting read! :)

Mara

@nyctef @tavianator I do think just adding "super" when the compiler suggests it works out fine in basically all cases! I just want it to be visible to a reader of the code, that something is going on with the lifetime of that object. Otherwise, it's very easy to hide a surprise in the code.

Go Up