I've just added closure support to my toy programming language: https://github.com/Wilfred/garden/commit/d1fb4566a2187dfe98fb1d2278a7a0d2acd8059e
Closures are more fiddly than I expected, but I now have a much better understanding of what downward/upward funargs are :)
(Downward: passing a closure, upward: returning a closure)
miniblog.
Related Posts
"Example Driven Development" using Glamorous and Pharo Smalltalk: https://medium.com/feenk/an-example-of-example-driven-development-4dea0d995920
Tests returning values and composing is a really interesting model. It establishes structure and shows which test failure is the most 'fundamental'.
I feel like Rust often pushes me to use concrete types.
It's a lot easier to return a Vec than an impl Iterator. It's not a big problem, but in e.g. Java I'd just say I'm returning some kind of iterator.
When I wrote my first Rust program, I got the advice "just clone everything until v1 compiles". I think this OK advice, but I think a better rule of thumb is "used owned types as much as possible".
I spent a ton of time returning &str or &[T] and fighting the borrow checker.