axelson

axelson

Scenic Core Team

5) ElixirConf 2017 - Don't Write Macros But Do Learn How They Work - Jesse Anderson

Here’s today’s talk:

ElixirConf 2017 - Don’t Write Macros But Do Learn How They Work - by @jessejanderson

You may have heard that “most of Elixir was written in Elixir” but what does that even mean, and how is that possible? Metaprogramming allows us to write code that writes code and, in addition to powering most of Elixir itself, has allowed for many great projects including Phoenix to exist. Even if you don’t have ambitions to create the next Phoenix, understanding metaprogramming basics and learning how the Elixir expressions work under the hood can lead to greater understanding of the code you write every day.

All talks are available in the Elixir Conf 2017 Talks List

Most Liked

JEG2

JEG2

Author of Designing Elixir Systems with OTP

Seems like a worthy goal to me and I would say that you nailed it.

jessejanderson

jessejanderson

Thanks for the feedback everyone, I really appreciate it!

@sillypog
Great to see you again at the conf - thanks for the kind words! The trick I’ve found is to trip up a lot myself, and then just try to document everything that didn’t make any sense to me. :stuck_out_tongue:

@JEG2
For sure, I’d love to have had another 30 minutes to talk so I could go deeper! :grin: I personally don’t have a ton of programming history prior to Elixir, so how macros work and especially the AST in general were difficult concepts for me to learn. I’ve heard some excellent talks that started just a couple levels above where my own knowledge was, so at the time I didn’t learn much because I couldn’t follow along.

So my top goal for this talk was that someone with very little background would walk out of the talk understanding 90% of what was covered, and that they could then watch any other Macro talks and be able to easily follow along by recognizing the same concepts. I also went long every time I did a run-through of the talk so I ended up cutting a couple of examples at the end that would’ve introduced a few more of concepts of Macros (e.g. I really wanted to do an example of __using__ but just didn’t have the time).

@axelson
As some others said, the reason for the 2-element tuple is to allow for the syntax of keyword lists, which I think might be important for the maintaining of do/else/etc blocks inside of the AST. I was planning to cover this in my original talk but had to cut it for time at the last minute. I’ve got the slide to prove it! There’s some additional info (though not a ton) in the Official Docs: Syntax Reference.

Also, could you add the elixirconf2017 tag to this post, thanks!

AstonJ

AstonJ

/Side note/

You can use a hash to auto-link to a tags page when in a post, e.g.: elixirconf2017 :023:

Where Next?

Popular in Talks Top

axelson
by @takasehideki Can you imagine that your Elixir code will be executed as a hardware circuit on an FPGA? The FPGA (Field-Programmable...
New
axelson
ElixirConf 2017 - Streaming Video with Elixir - @johnwahba Running a video stream is challenging. You can’t ...
New
derpycoder
QUIC protocol support coming to BEAM. As of now, I am using Caddy in front of Phoenix server to experience H...
New
axelson
ElixirConf 2017 - Elixir by the Bellyful - @bryanhunter Elixir makes me happy! Since 2007 I have been on the...
New
AstonJ
Kicking this thread of with the now infamous talk by Dave Thomas (or at least the best recording of it I can find) - please add any you f...
New
axelson
ElixirConf 2017 - Working with legacy databases in Ecto - @geo Often when starting an Elixir or Phoenix proj...
New
kokolegorille
Lonestar Elixir 2018 videos are starting to pop up :slight_smile: https://www.youtube.com/channel/UCOy-_b9bqjokoWX9Hg5ZgUg Day 1 Chris ...
New
axelson
We’re now on the day 2 talks! ElixirConf US 2018 – Understanding Elixir’s (Re)compilation – Renan Ranelli ...
New
axelson
by @jon At PagerDuty, we run our systems across many geographic regions to ensure we’re always available, even when you might not be. E...
New
ElixirConf
ElixirConf: ElixirConf 2023 - German Velasco - Using DDD concepts to create better Phoenix Contexts Comments welcome! View the <span cla...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41989 114
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement