Giter VIP home page Giter VIP logo

Comments (10)

mfikes avatar mfikes commented on May 17, 2024 2

For reference, here are the vars that Planck context switches for Socket REPL isolation (I believe these are faithful to Clojure's Socket REPL implementation): https://github.com/mfikes/planck/blob/78265343b531346baf663c4051a31b5ec2f8773e/planck-cljs/src/planck/repl.cljs#L1421-L1432

from lumo.

jmfirth avatar jmfirth commented on May 17, 2024 1

@mfikes your implementation in Planck should definitely be the reference we strive for, to my mind. I don't have near the experience of REPL development as I wish I did, so keeping these kinds of things in mind is very useful to me.

@anmonteiro sounds great! I coded this quickly this morning and had to leave, but I'll get it cleaned up a bit and submit a consolidated PR of the changes in a few hours time (I hope).

Thanks to both of you for the feedback! I'm really excited to see this feature come to life.

from lumo.

jmfirth avatar jmfirth commented on May 17, 2024

I have made a rough prototype of this in a branch in my fork feature/socket-repl.

This currently is hardcoded to 127.0.0.1:5555. You can connect to it from inf-clojure if you set (setq inf-clojure-program '("localhost" . 5555)).

Demo

from lumo.

mfikes avatar mfikes commented on May 17, 2024

This is cool stuff! One thing to consider is "socket REPL isolation" (keeping *1 etc. separate per season). In ClojureScript we don't have it as easy as in Clojure where you can rely on dynamic binding. In Planck I took an approach of "context switching," for lack of a better way to describe it.

from lumo.

anmonteiro avatar anmonteiro commented on May 17, 2024

Wow, this is great!
For a first pass it may be OK to skip @mfikes's suggestion as we don't implement *1, pst et. al.
Is there any other uses for said session/context switching?

@jmfirth do you want to put together a PR so that we can iterate on this?

from lumo.

mfikes avatar mfikes commented on May 17, 2024

A bit more info on the context switching (in case it is useful at the point Lumo considers something similar):

I believe Clojure leverages the thread-local nature of dynamic vars, with the necessary set bound on the socket REPL server thread, thus keeping any changes to them separate from other socket REPL threads. Since we don't have this in ClojureScript, simply "context switching" provides a close approximation.

But, another thing that might not be faithful to Clojure is the case that callbacks occur later, after the context switch has replaced things. I haven't looked at this in a while, but it is one area where context switching gets you pretty close to Clojure's behavior (and perhaps close enough), but truth be told, it is not exactly the same thing.

from lumo.

anmonteiro avatar anmonteiro commented on May 17, 2024

Just leaving this here too:
Planck's Socket REPL support commit

from lumo.

mfikes avatar mfikes commented on May 17, 2024

The equivalent (actually simpler) commit for Socket REPL support in C (the previous was Objective C) is planck-repl/planck@e023b27

from lumo.

jmfirth avatar jmfirth commented on May 17, 2024

Pretty close now to basic functionality. Here's a demo of evaluating a CLJS buffer with inf-clojure, printing the contents of package.json.

from lumo.

anmonteiro avatar anmonteiro commented on May 17, 2024

fixed 04075c7

from lumo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.