Repository navigation
Replies: 9 comments 7 replies
|
Basic "http repl" example working so far, just to see that code can modify the server process runtime state before doing any more advanced plumbing beforehand. Based on AMPHP event-source.php example, using Datastar library for swapping streamed html partials to view. rend.mp4Source: https://codeberg.org/jasalt/phel-snake-online/src/branch/main/src/httprepl.phel |
|
nREPL allows using various transits but default is bencode, so wrapped a encoding/decoding PHP library so that it can be installed as composer dependency and called with Phel functions / data structures: https://packagist.org/packages/jasalt/phel-bencode Streaming encoding/decoding is not implemented which seems to be the main way in mainstream nRepl server implementations but buffering line by line as done currently seems to work good enough for now while testing the overall implementation. |
|
Early version with Talking bencoded nREPL commands over socket to nREPL process, raw messages being: d2:op8:describee = {:op "describe} d4:code7:(+ 1 1)2:op4:evale = {:op "eval" :code "(+ 1 1)"} |
|
I got the Calva/VSCode connection working! There's some nREPL client specific glitches still, but I think connection should work with other text editor clients also (Neovim, Cursive, ...). Working primarily with Emacs Cider client myself but this should allow for better collaboration across editors regarding REPL stuff. linux_desktop_recording-2025-03-30_13.48.35.mp4Mirrored the repo to this platform also for convenience https://github.com/jasalt/phel-nrepl where issues can be posted with reference to Phel issue tracker. Continuing with tidying up the ops so completions would render properly etc. and looking how to make get REPL |
|
Everything still very experimental but I updated the https://github.com/jasalt/phel-nrepl project to use latest Phel version, cleaned up the codebase and did improvements in:
The
Developing/testing with Emacs Cider, Calva support may have regressed since adding initial support but checking it a bit later. |
|
Have been spending some time testing and getting eval working in more scenarios and finally got Amphp event source HTTP server demo working for a nice REPL live web coding example. Kooha-2026-04-07-17-54-00.mp4Example sources: https://github.com/jasalt/phel-nrepl/blob/b0d49dfc882011efd2c47d8a59bd5616c22c54a8/examples/event-source.phel |
|
Found out via Mastodon that @leobm has been working on Phel nREPL project too https://github.com/leobm/phel-nrepl with more focus on VSCode Calva and based on ReactPHP though he was interested to switch to Amphp also. We can possibly collaborate on the project to get it in working condition faster in way or another. |
|
Update: native nREPL server shipped in main (#1507) Big thanks to @jasalt and @leobm — your external implementations and the feedback loop on #1120-#1142, #1258/#1265 made landing this straightforward.
Accept loop uses PHP Fibers (one per client); bencode codec is a standalone lib. Tested against CIDER and Calva. Docs: docs/nrepl-guide.md. Would love feedback on:
Issues welcome for anything missing. |

Uh oh!
There was an error while loading. Please reload this page.
Disliking that async AMPHP server code needs a restart after every code change so I started to try puzzle together nrepl server for Phel using amphp libraries (byte-stream) that could run in same event loop as the http-server. Then application could be developed interactively.
In general, I think it could provide better text editor integrations for interactive development with existing tooling (Emacs Cider, VSCode Calva, Cursive, Neovim ...), if it can be made work.
Wrapping my head around bytestreams currently. Noted some useful pieces in ilt-phel for inspecting Phel runtime info.
All reactions