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
ElixirConf US 2018 Opening Keynote - The Next Five Years – José Valim (@josevalim) All talks thread:
New
axelson
by @SophieDeBenedetto LiveView’s reliance on server-rendered HTML and leveraging of bi-directional communication over WebSockets means ...
New
axelson
Here’s today’s talk: ElixirConf 2017 - Don’t Write Macros But Do Learn How They Work - by @jessejanderson ...
New
axelson
ElixirConf 2017 - Elixir Power Tracing - Gabi Zuniga Tracing is a technique for tracking events during a pro...
New
New
axelson
ElixirConf 2017 - Live APIs with GraphQL Subscriptions - @bruce and @benwilson512 APIs have gone live with G...
New
ElixirConf
ElixirConf: ElixirConf 2022 - Brian Cardarella - What is LiveView Native? Comments welcome! View the <span class="hashtag-icon-placehold...
New
AstonJ
File uploads are an essential part of many web applications, but often handling them can be tricky, which explains why they are one of th...
New
CodeSync
Introducing Phoenix Sync - James Arthur | ElixirConf EU 2025 | ElixirConf EU 2025 Comments welcome! View the <span class...
New
AstonJ
Keywords: LiveView autocomplete, LiveView search, focus Startups and web developers take note. Phoenix LiveView is the revolutionary fr...
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
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
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39467 209
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" =&gt; #BSON.ObjectId&lt;58eb1a7a9ad169198c3dXXXX&gt;, "email" =&gt; ...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement