Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

nREPL network REPL server (WIP)#794

jasalt started this conversation inGeneral
Discussion options

jasalt
Mar 6, 2025
Collaborator

Disliking that async AMPHP server code needs a restart after every code change so I started to try puzzle togethernrepl server for Phel using amphp libraries (byte-stream) that could run in same event loop as thehttp-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. Notedsome useful pieces in ilt-phel for inspecting Phel runtime info.

You must be logged in to vote

Replies: 4 comments

Comment options

jasalt
Mar 6, 2025
Collaborator Author

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 AMPHPevent-source.php example, usingDatastar library for swapping streamed html partials to view.

rend.mp4

Source:https://codeberg.org/jasalt/phel-snake-online/src/branch/main/src/httprepl.phel

You must be logged in to vote
0 replies
Comment options

jasalt
Mar 12, 2025
Collaborator Author

nREPL allows using various transits but default isbencode, 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.

You must be logged in to vote
0 replies
Comment options

jasalt
Mar 12, 2025
Collaborator Author

Early version with:describe and:eval nREPL operations (https://gitlab.com/jasalt/phel-nrepl) e.g.:

$ composer install$ vendor/bin/phel run src/nrepl.phel# on other terminal$ nc localhost 8888nREPL server started on port 8888 on host 127.0.0.1 - nrepl://127.0.0.1:8888d2:op8:describeed3:opsl4:eval5:clone8:describee6:statusl4:donee8:versionsd4:phel8:dev-main3:php6:8.2.26eed4:code7:(+ 1 1)2:op4:evaled6:statusl4:donee5:valuei2ee

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)"}

You must be logged in to vote
0 replies
Comment options

jasalt
Mar 30, 2025
Collaborator Author

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.mp4

Mirrored the repo to this platform also for conveniencehttps://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 REPLrequire working from non standard Phel Repl context (related Phel issue#766)...

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
General
Labels
None yet
1 participant
@jasalt

[8]ページ先頭

©2009-2025 Movatter.jp