shymega

shymega

Hi there.

I’m from primarily Clojure, and I always liked the REPL-driven deployment method that Clojurists use, with the REPL and dynamically building applications that way.

So, further to that end, I was wondering how easy that would be with Elixir/Erlang?

Any thoughts? I love Elixir and Erlang, but I do definitely miss the Clojure way of developing applications.

Showing Posts 1 to 10

NobbZ

NobbZ

Can you elaborate what that means for you? I have a REPL active virtually all the time, hot reloading my code to play with my API. Is this what you are referring to?

OvermindDL1

OvermindDL1

I’ve not used clojure, but if it is anything like lisp (since it was built like lisp) then a lisp program is not so much source code as it is a running state, and that state can change and mutate over time, and you can save out that state and reload it back in. Maybe clojure does the same? If that is what is meant then the BEAM has nothing like that. If that is not what was meant than more clarification needed. ^.^;

shymega

shymega OP

You’ve hit the nail on the head there. I wasn’t really quite sure how to describe what I meant, thanks! :smiley:

It’s the one thing I miss from Clojure, but I suppose keeping a REPL open and reloading works well, too. :slight_smile:

Thanks for your help, all.

peerreynders

peerreynders

Unlike Lisp, Clojure embraces immutability - save where mutability is necessary, like for Java interop (unless I completely misunderstood your meaning).

Now, if I’ve got my head on straight the primary impediment to “iex-driven development” is that you can’t define modules. Now keep in mind that I’m not the best person to talk about “REPL-driven development” as I’ve always found it a bit overhyped (possibly because I consider myself a lazy/slow typist). I’ve always been happy enough to kludge around with:

  • First terminal window running a text editor
  • Second terminal for running some kind of build script
  • Third terminal for running some kind of test script

So with “iex-driven development” you still need two terminals open - one to edit your modules another running iex where you have to manually re-compile and re-load the modified modules before you can run the updated code.

Edit: I stand corrected.

michalmuskala

michalmuskala

You can totally define modules in iex (unlike in Erlang’s shell).

NobbZ

NobbZ

Can you save them back? Ebin and source? Alter them easily? Meaning add a function and keep all that were already there beforehand? Delete a function?

peerreynders

peerreynders

I don’t recall being able to do that even in Clojure - but then again maybe I didn’t press it far enough. Basically I was just experimenting with alternate solution approaches.

This I remember doing in Clojure - essentially it felt like manipulating an in-memory representation of the code that would be run through the reader next time I executed something. In iex I’m not sure I would know where to start … in iex I basically stick to c/2, r/1.

michalmuskala

michalmuskala

This should be definitely doable on OTP 20 with the new debug info - I mean both adding or modifying a single function.

OvermindDL1

OvermindDL1

Wrong meaning. :slight_smile:

I mean that you can, for example, redefine a function and the new version is used from then on (old references still reference the old function, it is ‘safe’ in that way).

REPL driven development is basically you write code in the REPL, it is put in the system in real-time, any time you save you are saving a ‘dump’ of the system (no source code), and you can pick it up where it left off at any time. This was very popular in business distributing LISP since anyone could just spool up the server from the state and they could introspect the system, but no code distributed.

Easily yep, it just lacks the ability to write out the running ‘state’ of the system.

Yeah the LISP state was utter magic compared to anything else out at the time, even compared to today it is magic. ^.^

mischov

mischov

I think Elixir has quite a bit going for it REPL-wise (and I came to it from Clojure).

IEx is perfectly useful for exploration (one of the main things I used it for in Clojure), and can come close to the reloaded workflow if you’re using applications or ets to hold state. It has pretty good code reloading, though there are gotchas (like changing config)… but then there are gotchas in Clojure too.

My workflow with the REPL isn’t quite as smooth with emacs as it was in Clojure, but that’s more the result of not having spent the time to improve it than the tools being missing. I generally just iex -S mix in a terminal and flip over to it when I want to check something. Something like Cortex would probably improve things even more.

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 91898 914
New
AstonJ
The obligatory hello world thread! Who are you and where are you from? :stuck_out_tongue:
4616 55835 594
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
matt-savvy
Is there a word for the ~> symbol used in Version strings? Do you also just call it a Squiggle Arrow™ ?!
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
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
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
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