···380380Elixir 1.14.5 (compiled with Erlang/OTP 25)
381381```
382382383383-> Note no JIT as Nix on macOS currently[^currently] disable it and I didn't bother to enable
384384-> it in the derivation (it was disabled because there were some issues, but IIRC
385385-> these are resolved now).
383383+> Note no JIT as Nix on macOS currently[^currently] disable it and I didn't
384384+> bother to enable it in the derivation (it was disabled because there were some
385385+> issues, but IIRC these are resolved now).
386386387387[^currently]: Nixpkgs rev `bc3ec5ea`
388388
+6-5
content/post/eli5-ownership.md
···3636doesn't matter, but there will be only one owner. You can do whatever you want
3737with such note but with that power comes, not so great, responsibility: after
3838you are done with this book you will need to get rid of it. Since you are a law
3939-abiding citizen you will recycle the note in the appropriate receptacle, but it is your
4040-responsibility to do it. Of course this is not the only way to deal with a note. You
4141-can also give it to someone and then it will be hers or his responsibility.
3939+abiding citizen you will recycle the note in the appropriate receptacle, but it
4040+is your responsibility to do it. Of course this is not the only way to deal with
4141+a note. You can also give it to someone and then it will be hers or his
4242+responsibility.
42434344To rephrase it in the Rust way, it would look like this:
4445···140141141142But some notes are even shorter than that. They are so short and easy to clone
142143that it is much easier to clone them every time, instead of explicitly
143143-calling the method. Like when you give your phone number to a hot girl at the
144144-bar, the `Copy` trait automatically clones your note so the other has their own copy.
144144+calling the method. Like when you give your phone number to a hot girl at the
145145+bar, the `Copy` trait automatically clones your note so the other has their own copy.
145146Again, this is for small types that can be mechanically copied each time when needed.
146147147148```rust
+37
content/post/port-love.md
···11++++
22+title = "For F**k Interface"
33+date = 2025-11-03
44+55+[taxonomies]
66+tags = [
77+ "beam"
88+]
99++++
1010+1111+Erlang provides multiple forms of FFI:
1212+1313+- C Nodes - external applications, that (despite the name) can be implemented in
1414+ any language, not just C. It communicates with BEAM VM via Distributed Erlang,
1515+ and for all needs and purposes looks like "regular" Erlang node in cluster
1616+ (just can be implemented in any language). It provides greatest isolation, as
1717+ technically these two nodes do not even need to be on the same machine.
1818+- Ports - an external program, that is ran by BEAM VM and then communicates
1919+ via unnamed Unix pipes[^pipes]. It relies on OS for process isolation, which
2020+ mean that in the isolation level ladder it is placed in the middle.
2121+ [^pipes]: I do not know what this mechanism is called on Windows, sorry.
2222+- NIF (Native Implemented Function) - with that you write dynamic libraries,
2323+ that are loaded into the same address space as BEAM VM and then you can call
2424+ functions from this module like "normal" BEAM functions. That gives the best
2525+ performance out of three, but at the same time it isolates least. Writing well
2626+ behaving NIF is not easy, as you need to take into consideration the function
2727+ run time or use dirty scheduler, unhandled runtime errors will cause problems
2828+ for whole VM, and stuff like that.
2929+3030+3131+Technically there is another FFI option, but that one is legacy:
3232+3333+- Port Drivers - mostly a legacy stuff, these are modules, that are loaded
3434+ within the same address space as BEAM VM, but communication between different
3535+ languages is done like with Ports (just within single memory space). That mean
3636+ that you have disadvantages of both Ports (indirect communication) and NIFs
3737+ (system destabilisation in case of error), but without any real benefit.
-1
content/post/vim-for-elixir.md
···319319Google to find it). Instead I highly suggest You to dig into your own
320320configuration and for each line ask yourself:
321321322322-323322- Do I know what this line **does**?
324323- Do I really **need** this line?
325324