dergraf

dergraf

Shower Thought: Would Parameterized Modules have changed how Elixir (and its libraries) are designed?

Here’s a bit of a geeky thought experiment: Parameterized Modules (aka “Abstract Modules”) were an experimental feature in Erlang that never left the experimental stage and were ultimately abandoned in R16.

It got me thinking—if Elixir had such a feature, could it have influenced the way libraries like Ecto, Phoenix, or Ash were implemented, particularly when it comes to component-building abstractions?

Additionally, I wonder if Parameterized Modules might have offered interesting alternatives for implementing Protocols in Elixir. Their dynamic dispatch nature seems like it could align with what parameterized modules were designed to address.

Would this feature have simplified certain patterns, or would it have introduced unnecessary complexity?

I’m curious to hear thoughts, especially from those who’ve used both Elixir and Erlang and can reflect on how parameterized modules might (or might not) fit into Elixir’s design philosophy.

First Post!

binarytemple

binarytemple

I experimented with parameterized modules when they were available. In practice, they were simpler than they might have appeared at first glance. When you ‘initialized’ a module with a constructor argument, it merely created a reference with that initial value. Subsequent function calls on that module would automatically receive this initial value as their first argument - functionally similar to how Elixir’s pipe operator (|>) works today. While you could achieve comparable functionality using Erlang parse transforms, they were (and remain) significantly more cumbersome compared to Elixir’s elegant macro system.

Where Next?

Popular in Discussions Top

New
ricklove
I was just introduced to Elixir and Phoenix. I was told about the 2 million websocket test that was done 2 years ago. From my research, t...
New
crispinb
On reading dhh’s latest The One Person Framework it strikes me that Phoenix with LiveView is already pretty much this. However, never hav...
New
CharlesO
Erlang :list.nth simple, but 1 - based nth(1, [H|_]) -> H; nth(N, [_|T]) when N > 1 -> nth(N - 1, T). Elixir Enum.at … coo...
New
crabonature
I’m still quite new to Elixir. As I understand we got in Elixir “multi guards” as convention to simplify one large guard with or’s?: de...
New
rower687
Hi all, I’ve been reading a lot about the “let it crash” term and how supervising processes and the whole messaging passing make an elixi...
New
eteeselink
Hi all, In the last days, two things happened: A blog post titled “They might never tell you it’s broken” made the rounds. It’s about ...
New
und0ck3d
Hello everyone! A few days ago I’ve created a topic here about how people were creating CMSs with Elixir and Phoenix. I’ve been studying...
New
joeerl
I’m playing with Elixir - It’s fun. I think @rvirding does give Elixir courses these days. Re: files and database - when I given Erlang ...
New
kostonstyle
Hi all How can I compare haskell with elixir, included tools, webservices, ect. Thanks
New

Other popular topics Top

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
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41539 114
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
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
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
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

We're in Beta

About us Mission Statement