- Date: October 29, 2015
- Subject: Functions, methods, closures, and function as arguments!
This week’s episode covers the basics of all sorts of functions: normal functions, methods, and closures.
- An explanation (in Ruby) by Martin Fowler
- Rust book
- Rust by Example
- “What is a closure?” (Progammers Stack Exchange) – the first answer is the best, but the second answer may be a helpful stepping stone for people just getting their heads around this and coming from OOP languages like C++ or Java (even though I disagree with the explanation in some ways).
- Create a module so we can see public/private behavior.
- Shows how to take a function as an argument.
- Shows how closures can act on elements within their environment.
- Show how to call a function with a function as an argument.
- Shows how to use both struct and instance methods.