paulanthonywilson

paulanthonywilson

Blog Post: A fun, but trivial, limitation in Elixir ExUnit (/Macros)

It seems unlikely that anyone will find these facts interesting or useful, but here they are anyway.

Most Liked

LostKobrakai

LostKobrakai

This is not a limitation of ExUnit. This applies to everywhere in elixir. Module attributes essentially work by injecting the AST of the value into wherever the module attribute is used to provide a value. Values like a port don’t really have AST, which would give you the value back at runtime, which you had at compile time, so this doesn’t work. The same applies to any other value not easily transfered as AST from compile time to runtime, like e.g. anonymous functions.

paulanthonywilson

paulanthonywilson

Maybe the title’s not great, but that’s why I stuck the (/Macros) at the end. Your explanation does shed some light on this though - thanks.

Where Next?

Popular in Blog Posts Top

brainlid
In a 2 day spike, I created my own Elixir-based AI Personal Fitness Trainer! The surprising part for me was how useful and helpful I foun...
New
paulanthonywilson
I had a bit of a mini-adventure following Sobelow’s advice on adding a CSP to a Phoenix App. If you want to follow along, or want to add ...
New
paulanthonywilson
https://furlough.merecomplexities.com/elixir/otp/tdd/2021/03/18/test-driving-otp-creating-a-registry-with-expiring-entries.html Followin...
New
brainlid
Livebook was created for machine learning in Elixir but Livebook isn’t limited to machine learning. I found it works really well for docu...
New
paulanthonywilson
https://furlough.merecomplexities.com/elixir/otp/networking/nerves/2021/03/09/fun-with-multicasting.html Post on using UDP multicasting ...
New
ryotsu
How does a torrent client download huge files from the internet with just a .torrent file? In this post we’ll explore the BitTorrent prot...
New
bemesa21
Add drag-and-drop functionality to your Phoenix LiveView app with SortableJS and LiveView Hooks! This posts shows you how to create an in...
New
ConnorRigby
Just finished a post for Embedded Elixir and I thought it should be cross-posted here: I’ll update this thread as posts get published. ...
New
axelson
I talk about how I really like to use runtime configuration and discuss some common pitfalls of configuration in Elixir.
New
brainlid
OTP 26 was released and the Elixir 1.14.4 builds have been updated! Erlang OTP 26 changed how map keys are sorted, or not sorted actually...
New

Other popular topics Top

fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New

We're in Beta

About us Mission Statement