My personal blog hauleth.dev
blog
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: remove drafts from master

-86
-59
content/post/erlang-in-mix.md
··· 1 - +++ 2 - title = "Erlang in Mix" 3 - date = 2019-07-24T12:32:07+02:00 4 - draft = true 5 - +++ 6 - 7 - Currently there are 3 main build tools in BEAM world: 8 - 9 - - Rebar3 - de facto standard in Erlang and other languages (with exception to 10 - Elixir). Uses declarative `rebar.config` file (which is in `file:consult/1` 11 - format) that can be then formatted via `rebar.config.script` Erlang script. 12 - - Mix - standard build tool in Elixir world. Uses imperative `mix.exs` file. 13 - - erlang.mk - GNU Make based tool. Uses it's own registry and is mostly known as 14 - tool used by Cowboy. 15 - 16 - In this article I will cover only first two and their comparison when it comes 17 - to support building mostly Erlang projects (AFAIK `rebar3` do not have yet 18 - support for building Elixir projects, mostly because Elixir cannot be used as 19 - Erlang library). 20 - 21 - ## Declarative vs imperative 22 - 23 - Accordingly to [Wikipedia][declarative programming]: 24 - 25 - > In computer science, declarative programming is a programming paradigm—a style 26 - > of building the structure and elements of computer programs—that expresses the 27 - > logic of a computation without describing its control flow. 28 - 29 - In other words, we only describe **what** without focusing on **how**. This mean 30 - that we have less direct control over our configuration while requiring less 31 - knowledge to configure properly. 32 - 33 - At the same time it is (in theory) more secure, as imagine that you would have 34 - dependency with such `mix.exs`: 35 - 36 - ```elixir 37 - defmodule TotallySafeLibrary.Mixfile do 38 - use Mix.Project 39 - 40 - # HAHAHA I lied!!! Pwnd MF 41 - File.rm_rf!(System.user_home()) 42 - 43 - # … 44 - end 45 - ``` 46 - 47 - I mean, this is still possible in Rebar via `rebar.config.script`, but it is 48 - much harder due to 2 reasons: 49 - 50 - - There is no such function like `File.rm_rf!/1` in Erlang, so the end user 51 - would need to write their own. 52 - - It is much easier to spot additional file in the repo than review whole one 53 - file. 54 - 55 - The same goes for `.app.src` file, which while having more "abstract" format 56 - than Mix's `application/0` function ends much simpler without all imperativeness 57 - brought by making configuration file executable script. 58 - 59 - ## Tasks
-27
content/post/who-watches-watchmen.md
··· 1 - +++ 2 - title = "Who Watches Watchmen" 3 - date = 2020-02-01T23:13:44+01:00 4 - draft = true 5 - +++ 6 - 7 - ## OTP supervisors 8 - 9 - If you are reading this post then you probably found it via Erlang/Elixir 10 - community so you should be at least a little bit familiar with the OTP 11 - supervisors concept. If you aren't yet because you have found it by other matter 12 - then I highly encourage you to learn a little about it, however I will try to 13 - introduce that concept a little bit there as well. 14 - 15 - ### Erlang process tree 16 - 17 - In Erlang the basic "building block" of the whole application is something 18 - called process. It is very much like system process (we will expand that 19 - later), but much less costly to spawn. The 20 - 21 - ## Why we need system supervisor 22 - 23 - ## How system supervisor works 24 - 25 - ## How to use OTP with systemd 26 - 27 - ## What will be possible in future