Rust Linz, October 2021 - Rust Closures by Rainer Stropek

preview_player
Показать описание
Rust 2021 came with a significant enhancement regarding closures: Disjoint Capturing. In this session, Rainer Stropek starts by describing how closures work in Rust. This is for relative beginners in Rust who know closures from other programming languages and want to know what's different in Rust. Based on that, Rainer illustrates the new disjoint capturing feature in Rust 2021 based on a "fairy tale" code sample.

Рекомендации по теме
Комментарии
Автор

Had to add a comment. Rainer, that was a brilliantly conceived and delivered talk. One of the clearest on Rust I have heard so far. Keep up the good work!

robertmullings
Автор

Mr Stropek you are one of the best exposer i“ve ever heard on the topic. This talk was invaluable for me! Thanks a lot.

Rust, give this man more talks please. And ty you too.

kurkdebraine
Автор

that was just perfect recap, glad you introduced the 2021 features too !

Roms
Автор

the presentation skill is impressive. thank you, sir!

thanhtant
Автор

Wow, I never thought about FnOnce like case in closure context before. I guess Rust force you to think about all these details and subtle differences. Thanks for the awesome presentation.

kaypope
Автор

Yes, this is essentially how the syntax is done in Ruby! A language famous for being extremely difficult yet still deterministic to parse.

KaneYork
Автор

The way you have explained, is quite useful. Coming from the Scala world, I am trying to map my understanding between two languages (and their philosophies). This presentation supplements that very well. Thank you.

nirmalyasengupta
Автор

Great talk, I just have a meme 32:23
Rainer: You can use disjoint closures in real-world examples.
Also Rainer: *Literally uses disjoint closures in a fairy tale example*

sagnikbhattacharya
Автор

Great talk. Lambdas are one of the few things where I prefer the C++ version. In C++ it's clearer what's being captured and what kind of capture it's using for each variable.

luizchagasjardim
Автор

A small correction at 4:46 you said the line "let f: fn add(i32, i32) -> i32 = add;" declares "f" as a function pointer. "f" is actually a function item which is a zero sized type that statically represents a specific function. If you made it mutable and later assigned it to "fn sub(i32, i32) -> i32" this would fail to compile

TinBryn
Автор

This was very well done. I really appreciate this talk; I definitely learned something.

Galakyllz
Автор

Great, your explanation is so clear.... thanks.

saaddahmani
Автор

Thank you very much for this clear explanations. Though I am not very strong in Rust (kind of post-beginner), I was able to follow it. I just have to make me a refresher on concepts like dyn keyword with Traits. But for sure, I can find many videos/blogs explaining this concept.

Very good video.

funcder
Автор

Great talk about rust closures. I have a question irrevalent to Rust. How did you annotate certain area of code in vscode during desktop recording? Is it a featue of your live broadcast software?

changtimwu
Автор

I'm confused by the use of the term closure for all the examples around the 7 minute mark. They seem to be just lambdas or anonymous functions, and they don't close over any values from the environment. They don't use arguments from the surrounding scope, so why are they closures?

theherk
Автор

Wow, needing to box the closure which allocates on the heap when you reference an external variable seems heavy! C++ lambda capture by reference seems much more lightweight in comparison

jhbonarius
Автор

"You can remove the parentheses and make it even nicer"
...i wish everybody thought like that
I had a discussion with my tech lead (C#) and proposed thing like that. He hated it. He still seems to have problems with moving from VB to C#, and would even prefer to use "end function" and such over parentheses...

jhbonarius