dmitriid
It’s one of those “if you try it, you can figure it out” questions. I’m just hoping someone has already done this before and has some quick tips or a link to look at ![]()
The meat of the question is: I have something in a file (data, or a custom DSL, or anything, really). Using this something, I want to create and compile an Elixir module and load it into the running application. When that something changes (let’s say, a file watcher tells me that contents have changed), I want to re-create/re-compile that module and reload it.
I know that I should start looking at Module.create/3. Perhaps there are other things I can/should look at and consider?
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
Testing Concurrency and Fault Tolerance in Elixir/Nerves - Marta Habdas | ElixirConf EU 2026
Comments welcome! View the <...
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
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
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
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
kokolegorille
You might use @external_resource attribute on a module…
If the external resource file change, the module will recompile.
03juan
You could try Code.eval_string/3 if you want to parse the changed “something” file from within Elixir to produce a string representation of the module def.
Alternatively Code.eval_file/2 if you dynamically write/update an
.exfile from your “something” file.mudasobwa
This is compilation-time dependency, which helps to mark a module as “recompilation needed” for the regular elixir compiler when say
mix compileis to be invoked next time. It has zero value here, unfortunately.Yes, kinda. There is a pitfall one should be aware of: the module recompilation is not instant.
I would spawn the process as gateway access to the module to be recompiled that both recompiles whatever is needed and its mailbox acts as a queue for both subsequent recompilations and all the interactions with this module. That way one can be sure that the module gets accessed if and only it’s available.
Please note, that
Module.create/3accepts an AST. If you want to load a regular.ex[s]file, useCode.eval_file/2as suggested by @03juan.kokolegorille
Oops, my bad… I did not catch it should be for runtime.
dmitriid
Good point/catch about the queue. Especially if I want this to be based on a custom DSL or custom data, compilation will definitely not be instant.