Weekly Shaarli

All links of one week in a single page.

Week 06 (February 5, 2024)

Extending Rust's Effect System

An article on how Rust can benefit from an effect system.

ElixirNitpicks

Nice write up. Aside from these mentioned, I also wanted to point out a few problems about Protocols.

  1. the implementation on struct is fine, but implementations on primitive types are very different and sometimes awkward
  2. the first argument is forced to be the type that implements the protocol, making it difficult to define abstract methods on, for example, a set of values
  3. there is no concept of associated type, associated constant,
  4. the role of protocols mostly overlaps with a @behaviour but a behaviour is more flexible

And here are more places I'd like to see improvements (some pointed out in the article, too):

  • the lack of simpler struct construction/deconstruction syntax sugar, forcing everyone to write code like %{a_long_property: a_long_property} repeatedly
  • the lack of early return. the design of with discards the information about the mismatching branch.
  • Ecto.Multi is not composable (I tried to fix it via https://github.com/shouya/ecto-tx)
How To Write Stuff No One Else Can – The Write to Roam

The information advantage over your competitor is something you can choose to cultivate. In journalism, one can avoid large topic on key persons that everyone went about, instead focus people with just as much insight and far less attention.

Design safe collection API with compile-time reference stability in Rust - COCl2's blog home

This article explores how we can separate the lifetime of values in a container from the lifetime of the container structure. The author approach the problem by issuing a token (zero-sized type) with an invariant lifetime. TIL ghost token. I think the type AppendOnlyVec (Vec<Box<T>>) could make a more straightforward example.