rebar3_clojerl icon indicating copy to clipboard operation
rebar3_clojerl copied to clipboard

Possibility for improved usability for Clojerl REPL from a release?

Open oubiwann opened this issue 5 years ago • 3 comments

If I create a Clojerl release and start the app(s) in console mode (where PROJ_BIN points to an app's release script):

CODE_LOADING_MODE=interactive $(PROJ_BIN) console

I need to do the following to get a Clojerl REPL:

> 'clojure.main':main([<<"-r">>]).
Clojure 0.6.0
clje.user=> 

However, I can start the REPL directly from the CLI by doing this:

CODE_LOADING_MODE=interactive $(PROJ_BIN) start
$(PROJ_BIN) eval "'clojure.main':main([<<\"-r\">>])"
$(PROJ_BIN) attach;

Maybe there's a nicer way to provide this functionality for Clojerl developers?

oubiwann avatar Jul 10 '20 16:07 oubiwann

@oubiwann Did you have something specific in mind in terms of improved usability? What does LFE provide in this case? Is there an lfe:repl/0 function or something similar?

jfacorro avatar Jul 21 '20 07:07 jfacorro

I actually didn't have anything in mind! Was mostly opening this as a brainstorming ticket.

The LFE situation is actually less friendly, as the start/eval/attach option doesn't work for the LFE REPL 😢 It has no release-specific goodness to offer; you can only start up the release console and then lfe_shell:start().

Oh, so ... there is something that I've done for the updated LFE rebar3 plugin, though: I've added support for rebar3 lfe run-release (there's also a run and run-escript). Since the rebar3-generated release script is an actual shell script, this is a bit of a hack: the plugin uses rebar3 utils to assemble the path to the release bin dir and then uses os:cmd to call the script, supporting passing args to it (so that this sort of thing works: rebar3 lfe run-release start or rebar3 lfe run-release ping, etc.).

That might be more hackery than your interested in having as a part of the Clojerl rebar3 plugin?

Here's the code:

  • https://github.com/lfe-rebar3/rebar3_lfe/blob/release/0.3.x/src/rebar3_lfe_prv_run_release.erl

Hrm, not really sure it's worth it ... even if we provide a means of starting and evaling the Clojerl REPL, the user's ultimately going to have to type the full path to the script in order to get an interactive session with the console. Maybe you can think of something clever that will work? ;-)

oubiwann avatar Jul 22 '20 02:07 oubiwann

If you are interested in creating a rebar3_clojerl command to run a release, note that I have run into an issue I haven't had to time to sit down and sort out. I've created a ticket for it here:

  • https://github.com/lfe-rebar3/rebar3_lfe/issues/33

oubiwann avatar Jul 22 '20 02:07 oubiwann