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

New
aymanosman
This is a very short article about using AWS Systems Manager Parameter Store to load secret configuration in a simple way.
New
paulanthonywilson
All a bit meta, but this is a quick post on creating a Jekyll blog post from a Livebook page. Posted via Devtalk (see this thread for ...
New
brainlid
I love LiveView. Navigating between views is so fast! This quick tip makes navigating feel instantaneous by adding a split-second delay b...
New
aymanosman
The desire to produce structured logs is common. In this article, I will survey the major approaches one could take to achieve this goal ...
New
New
rms.mrcs
Hi, everyone! In this article I describe how I created a simple metrics engine that can list to Hackney metric updates and send this data...
New
paulanthonywilson
Whatever your Nerves project does, there’s a good chance that it can be enhanced by securely connecting to a Phoenix Server in the cloud;...
New
AstonJ
Update: How to use the blogs section You can post in one of the Official Blog Posts threads (like this one), or, via Devtalk and a new t...
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New

Other popular topics Top

stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
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
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
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
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
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