abreujp

abreujp

I’ve published a new article in my Elixir learning series on dev.to exploring module attributes - the compile-time annotations and constants that describe and configure our modules.

The article covers:

  • The three roles of module attributes: annotations, temporary storage, and compile-time constants
  • Setting and reading attributes, and how compile time differs from runtime
  • Using attributes as constants, including inside patterns and guards
  • Precomputing values at compile time and exposing them through functions
  • Documenting modules and functions with @moduledoc and @doc
  • Describing function contracts with @spec and typespecs
  • Defining custom types with @type, @typep, and @opaque
  • The @vsn, @derive, @behaviour, and @impl attributes
  • Registering custom attributes with Module.register_attribute/3 and accumulating values across the module
  • Practical guidelines for when to reach for an attribute instead of a plain function

With complete working examples you can copy into IEx, you’ll learn how module attributes become the glue between documentation, configuration, and compile-time behavior - and how they shape the Elixir code you read every day.

Check it out:

Where Next? Top

Trending in Blog Posts Top

bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
pckrishnadas88
Hey everyone! :waving_hand: I’ve published Part 7 of the Building Distributed Systems in Elixir series, where we build core distributed ...
New
zorn
An educational side project in Elixir, Phoenix, and Tauri. I share what I learned while wiring Automerge into the BEAM, including how I s...
New
nathanl
Process labels are useful for visualization and debugging. Here’s why you should use them.
New
andreasronge
What happens if you design tools for LLMs instead of letting LLM use human tools ? Wrote a blog on why and what that enables. As I see ...
New
mudasobwa
Somewhere, right now, a senior engineer is on the verge of a nervous breakdown because his company will not let him switch from Claude to...
New
zorn
:pencil: Phoenix’s built-in LiveView test helpers require you to hand-build the form payload and start a fresh pipe after every click. Wo...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews