current read time: 8 days
Basically new stuff(TIL) updated as I encounter.
- elixir is not a pure functional language (it is immutable but has side effects!)
- brushed up some basics/apis
receive
loops have minimal impact on clock cycles
- NIFs are not a magic potion (nuance)
- differences in implementation of protocols for internal data structures e.g String.Chars and why certain behaviours like Access are not defined on Structs by default (refresh)
- grokked when GenServers are actually useful, transient shared runtime state, concurrent orchestration, long lived state management (refresh), remember the api: https://elixir-lang.org/downloads/cheatsheets/gen-server.pdf
- local name registration of GenServers is unique per runtime instance, not just a single runtime. ie. starting and stopping the VM.
- grokking supervision trees(finally!)
https://www.erlang.org/doc/design_principles/des_princ.html
error handling via defensive programming for kernel modules or functions try/rescue.
runtime errors: throws
, errors and exits
.
try do
File.open(”./whatever.json”)
rescue Error
# oh no!
after
# cleanup
end
processes can capture the stack trace of another process with Process.flag(exit_code, true)
you can have:
- bidirectional linked processes link(pid_or_port)
- unidirectional monitors → Process.monitor(pid)