Twitter | Pretraživanje | |
Esteban K 🦀⚙️
Lazy Twitter: can you send me snippets of code where you *needed* higher kinded lifetimes? I wish to identify as many cases as possible to categorize them and make rustc understand them and guide you in their direction.
Reply Retweet Označi sa "sviđa mi se" More
Esteban K 🦀⚙️ 26. sij
Odgovor korisniku/ci @ekuber
Even better if you can also show me the road you took to reach the understanding that HKLT 1) were a thing and 2) you needed to use them.
Reply Retweet Označi sa "sviđa mi se"
Félix Fischer 26. sij
Odgovor korisniku/ci @ekuber @rustlang
Wait, what *are* HKLT? Can you point me to some resources? They sound mightily interesting.
Reply Retweet Označi sa "sviđa mi se"
Esteban K 🦀⚙️ 26. sij
Odgovor korisniku/ci @FelixFischer91 @rustlang
It's the `for<'a> fn(&'a T) -> &'a K` syntax, so that you can pass around closures that have borrows that are related to its inputs, but detached to the current Item context.
Reply Retweet Označi sa "sviđa mi se"
Manish 26. sij
Odgovor korisniku/ci @ekuber @rustlang
i don't have examples on me but in stylo we almost needed them due to a lack of GATs with lifetimes (you can hack it with for<'a> Trait<'a>)
Reply Retweet Označi sa "sviđa mi se"
Esteban K 🦀⚙️ 26. sij
Odgovor korisniku/ci @ManishEarth @rustlang
That is precisely the kind of out of the left field use I want to hear about!
Reply Retweet Označi sa "sviđa mi se"
David Tolnay 26. sij
Odgovor korisniku/ci @ekuber @rustlang
I think you are asking about higher *ranked*, not higher *kinded* which are a different thing. Primer:
Reply Retweet Označi sa "sviđa mi se"
David Tolnay 26. sij
Odgovor korisniku/ci @ekuber @rustlang
Higher kinded would be a lifetime from lifetimes to lifetimes (??). Higher ranked would be a "for any" lifetime.
Reply Retweet Označi sa "sviđa mi se"
David Barsky 26. sij
Odgovor korisniku/ci @ekuber @rustlang @mycoliza
We needed them in `tracing` (), especially the `LookupSpan` bounds. I don't recall _why_ we ended up needing them; I think short-circuited that search process for me.
Reply Retweet Označi sa "sviđa mi se"
electronic liza 26. sij
Odgovor korisniku/ci @endsofthreads @ekuber @rustlang
the trait methods return a struct with a reference to the receiver in it; we need HRTB so that we can bound a generic type parameter with that trait without also being generic over the lifetime
Reply Retweet Označi sa "sviđa mi se"
Tyler Mandry 27. sij
Odgovor korisniku/ci @ekuber @rustlang
IME, it’s most frequently used for function pointers and Fn* bounds
Reply Retweet Označi sa "sviđa mi se"
o0Ignition0o 27. sij
Odgovor korisniku/ci @tmandry @ekuber @rustlang
I read it Fn starbound and it just made my day.
Reply Retweet Označi sa "sviđa mi se"