abreujp

abreujp

I’ve published a new article in my Elixir learning series on dev.to exploring the module directives — alias, import, require, and use — the four tools that control how names from other modules become available in ours.

The article covers:

  • The difference between the three lexically scoped directives and the use macro
  • Using alias to shorten module names, including the :as option, grouping with braces, and nested aliases
  • Bringing functions into scope with import, with only:, except:, and filtering functions vs macros
  • How lexical scope works inside functions and what happens when imports collide
  • Opting into macros with require, using the classic Integer.is_even/1 example
  • use as an extension point and how it expands to require plus a using/1 callback
  • Putting all three directives together in a realistic module
  • Practical guidelines for when to reach for each tool — and why alias often beats import

With complete working examples you can copy into IEx, you’ll learn how these directives shape the namespace of a module and make the origin of every name clear — a big step toward reading and organizing Elixir code confidently.

Check it out:

Where Next? Top

Trending in Blog Posts Top

mudasobwa
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New
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
A while back, I had to process millions of database updates in a legacy system that was already hitting its 64 GB RAM limit, so scaling t...
New
zorn
As I’ve leaned into AI code generation on LocalCents, the volume I ship has climbed, and my worry shifted from any single change to the l...
New
smaller_infinity
I recently figured out how to the the Rust hotpath profiling crate running in an elixir benchmark script (for profiling NIFs). I had some...
New
pckrishnadas88
This article demonstrates how to build a minimal stateful process using only Elixir’s core concurrency primitives: spawn/1, send/2, recei...
New
tiagodavi
How I used Duckdbex to go from 35 seconds to sub-second latency on 75M+ data points. Duckdbex is an Elixir library that embeds the C++ D...
New

Other Trending Topics Top

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
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews