GenericJam
In several talks, Joe Armstrong talks about sending functions and doing the processing on the other side of the connection instead of sending the data back and forth. Presumably this saves bandwidth, etc.
Is anyone doing this in practice? In what domain and what problems does it solve? Should everyone be doing it this way?
Trending in Discussions
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
Hi there! :wave:
@frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
New
Other Trending Topics
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
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
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex











Showing Posts 1 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Qqwy
It is a very clear power vs. clarity trade-off. See for instance the paper “Out of the Tar Pit” for more information on why too much power in a programming environment can be considered a bad thing. (I very much recommend this paper!)
As quick summary (the paper describes it much better), consider:
So: While it is a cool concept in theory, in practice you should try very hard to avoid it, because that will make your application more resilient. (With ‘resilience’ being an informal notion of ‘easier to understand’ + ‘easier to test’ + ‘easier to adapt to changing requirements’)
dimitarvp
Saving bandwidth these days doesn’t seem to be very important. I mean, unless this approach compresses an 1MB payload to 1KB then you shouldn’t prioritise any technique that can shave off a few hundred bytes in total.
Adzz
Galaxy brain: what if your functions are data.
Let’s take filtering a list of integers as an example. We could define Filter as a protocol like so:
Now let’s encode our predicate as data:
Now Lets implement the zip for a list
All of that lets us do this:
Which gets us close. We now just need to capture all of that in its own struct. We’ll define a general function application protocol:
Then implement if for Filter:
Now we can create our Filter function as a data structure, and as long as where ever we are sending it has the right protocol implementations we can consume it:
What even more interesting is because it’s all protocols each dimension of the filtering problem is extensible. Filtering a collection has 3 dimensions to the problem, the collection being filtered, the items in the collection and the predicate that determines whether something stays in the collection.
Lets now make it so that we can filter on Decimals inside lists:
Okay and now let us filter on maps as well as lists:
Disclaimer, I just find this interesting I have no idea whether it’s a good idea to actually use.
al2o3cr
If you’re using Agent, you’re doing it already - for instance,
Agent.update/3passes an anonymous function to the agent’s process, which then calls the function with the agent’s state.The bandwidth being saved here is memory bandwidth; bringing the function to the data avoids the overhead of copying the data to a different process.
Qqwy
I mean, you might have heard the saying objects are a poor man’s closures… closures are a poor man’s objects somewhere: We can emulate function calls (possibly with bound variables, AKA closures) using only data, and emulate a full-fledged object system using only closures.
Also, in an essence, when you are defining an API (say, a REST web-API), you are essentially creating a data-representation that someone can use to call your functions.
In (bytecode-)interpreted languages like Elixir, the similarities go even further, because there a compiled function really is a binary of instructions that you can read (and, if you want to live dangerously, modify directly). The same is of course true of machine-code on any system following the Von Neumann architecture, because there data and instructions are stored in the same place. There are very little practical reasons for writing self-modifying code, except to ‘be cool’ or write e.g. computer viruses that try to camouflage themselves.
It is exactly because of that reason, by the way, that e.g. WebAssembly is not following the Von Neumann system and keeps instruction-memory and data-memory separated.
as a side note: interesting tangent about protocols! If you want to read about that kind of stuff some more, you might find some fun tidbits, abeit about Haskell rather than Elixir, here.
rvirding
One thing you should be aware of is that it is very very sensitive and risky to send functions from one to node to another node. Sending a function does not send the actual function code as the function only contains the module name, a checksum of the module, a reference to the function code and the closure, . The checksum is sent to ensure that it is exactly the same module which is used. If it isn’t then you get an error. So you must have exactly the same module on both nodes, even adding comment lines can ruin it.
This is because functional objects came later when the code handling had already been defined and implemented.
Adzz
I had not heard that thanks I’ll have a read.
Yea I find the protocol thing intersting I’ve been playing with the concept on a branch of my zip library here: GitHub - Adzz/Zip at go-crazyy-ah-ah-go-stupid-oh-oh · GitHub
and wrote about it here: https://medium.com/@ItizAdz/zip-elixir-abusing-protocols-for-triple-dispatch-and-ultimate-flexibility-4c817a5940d6
It felt like I was heading towards creating a poor type system in some way. and I’m sure it links to defunctionalization somewhow Defunctionalization: Everybody Does It, Nobody Talks About It | SIGPLAN Blog