Skip to content

7ML7W Elixir Day 2 Controlling Mutations

Murray Steele edited this page Jun 6, 2018 · 7 revisions

The Meeting

Intros are made. Bread is dipped. Pringles are stacked. Drinks are drunk.

Time to get into Elixir Day 2 and learn all about macros.


@adzz is our resident Elixir expert (in that unlike the rest of us he does Elixir at work) so he volunteers to lead us through the material both physically and spiritually.

The chapter is mostly about how Elixir is a bit like LISP, and so it leads us towards writing Macros, which is a strange choice as @adzz tells us that the community preference is not to use macros unless you really need them. We wonder if, like the Elm chapter, the material in the book was written before the community had properly coalesced on this opinion.


We explore mix, as we're mostly rubyists we compare it to a combination of bundler, gem and rake all in one.

@h-lame: do all modern langs have a mix?

All: yes!! (mostly)

We agree that this seems good.

Go doesn't have one yet, but they're getting close to coming up with one. What it does have is gofmt. We noted that Elixir seems to complain about whitespace during compilation time so it has a gofmt baked in. @adzz shows us that there is a command in mix to format it which will fix compilation errors that might occur, but it will also fix formatting that wouldn't cause compliation errors. It's a mix of preferntial vs. compilation-breaking rules.

@adzz: It's not community led like rubocop, but you can raise issues to change it. Our team is happy with it.

@marksweston: I found Elm's style weird, it seems it was optimised to minimise the git diff, like putting commas first on newlines. It wasn't optimised for human readability!

All: murmurs of agreement that this seemed bad.


@charlieegan3: In ruby you ship gems so you can run their rake tasks in protuction and in rust you do similar by shipping crates. Is that the same with elixir and mix?

@adzz: I'm not sure!

Adam shows us a library of his called maybex so we can explore the mix stuff that a library would provide. We explore it for a bit but are sidetracked by his chrome extension for github, octotree, which is very shiny.


@h-lame: What's the difference between .ex files and .exs files?

@adzz: I don't know really. I think it's something like ex files are library code and exs files are scripts, but both contain the same kind of code.

[@@dkandalov]: I think exs are compiled on the fly, but ex are compiled once?

@adzz: Yes, maybe. One thing I know is that you pretty much only use exs for test files, and ex for everything else.


to be continued


Wrap up

Many: It's been great having someone who knows the language quite a bit to drive and prod us in the right direction.

@tuzz: It's been a good format to jump between repl, book, examples, etc.

@dkandalov: Exploring tangents that were not really covered in the book was good too. We shouldn't be stuck on just the book as what to explore.

@h-lame: We didn't cover everything in the chapter tonight, but I got lots out of what we did cover. Not charging ahead is good.

@tuzz: I'll organise next time!

fin

Thanks

Thanks to @elenatanasoiu, @h-lame and Unboxed for hosting and providing beverages, to @h-lame, @charlieegan3 and @dkandalov for bread, dips and snacks and to @adzz for shepherding as our resident elixir expert.

Clone this wiki locally