« first day (2852 days earlier)      last day (641 days later) » 

3:04 PM
posted on August 05, 2022 by Niko Matsakis

As of Rust 1.63 (releasing next week), the "non-lexical lifetimes" (NLL) work will be enabled by default. NLL is the second iteration of Rust's borrow checker. The RFC actually does quite a nice job of highlighting some of the motivating examples. "But," I hear you saying, "wasn't NLL included in Rust 2018?" And yes, yes it was! But at that time, NLL was only enabl

 
 
2 hours later…
5:30 PM
@Ă–merErden Thanks for the link. So if I understand correctly, the len() method probably takes the reference type, and when we do s.len(), the &s gets added to the list "candidate receiver types" and len() is then called with it..
@kmdreko What confuses me is the method being called by both a reference and a non-reference variable. @ÖmerErden 's answer's link discusses this. Although I admit being a beginner, I didnt get everything in it.
 
@Haris Ah ok. Rust will handle this.method() syntax with a bit more convenience than normal function arguments, it will auto-ref or auto-dereference the object as needed to satisfy the function signature. So String, &String, &&String, &&&String, etc. variables can call .len() directly. See this Q&A for more info: stackoverflow.com/questions/28519997/…
 
5:51 PM
@kmdreko Nice, thanks for the link. Although I do not see any answer discussing the design decision which led to this.
 
@Haris The design decision was: forcing the developer to write (&s).len() or (*s).len() is annoying, unnecessary, and leads to less readable/maintainable code
 
Hmm.. I am wondering if doing all this decision making under the hood has led to some weird behaviours. But I am too early in my journey to be able to catch something like that.. I will simply observe and keep walking.

Thanks for the answers )
 
6:35 PM
@Feeds "The next frontier for Rust borrow checking is taking the polonius project and moving it from research experiment to production code." - anybody got insight on the progress of this? My understanding was it has been functional for a good while, but needed to be faster? But the active PRs and issues make it seem like they're still working through it (?)... Anybody been following the progress?
 
@Haris If you worry about ambiguous situations Fully Qualified Syntax is there to solve it. ( It was also mentioned it in the link that shared by @kmdreko). You might want to check this link as well , it also points that "All function calls are sugar for a more explicit fully-qualified syntax"
 

« first day (2852 days earlier)      last day (641 days later) »