corank
Joined 2 years ago
Karma
26
Submissions
27
Member since
Apr 5
Joined 2 years ago
map : (a -> b) -> a list -> b list
instead of map : a list -> (a -> b) -> b list
The main argument (data to be operated on) is positioned last, after the others which are more like parameters that tune the function.
It's to allow chaining these things up left to right like Unix pipes: map f l |> filter g |> ...My understanding is that Rust doesn't have _automatic_ reference counting as in Swift only because it has an alternative (move), which requires the programmer to specify their intent. The principle is nevertheless the same: ensure every time a reference is copied the ref count is incremented, free only when ref count is zero, and we get temporal memory safety.
I'm not familiar with Swift though so my understanding could be incorrect.
Does the conversion happen during run-time? Isn't that going to be super expensive?
What if the unsafe code is not supposed to be pure but mutates some memory? For example, does this allow implementing a doubly-linked list?
Essentially turning kwin into a tiling WM