Comments (10)
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.
@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.
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))
.
from lumo.
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.
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.
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.
Just leaving this here too:
Planck's Socket REPL support commit
from lumo.
The equivalent (actually simpler) commit for Socket REPL support in C (the previous was Objective C) is planck-repl/planck@e023b27
from lumo.
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.
fixed 04075c7
from lumo.
Related Issues (20)
- Improvements to exception messages and printing HOT 4
- 93k for compiled hello world HOT 9
- Spurious toine in lumo banner HOT 1
- Make Google Closure Compiler implementation selectable
- coping directories HOT 1
- How to add libraries like andare to a lumo build? HOT 6
- Could Lumo not depend on glibc ? HOT 6
- require doesn't work inside of expressions HOT 2
- eval doesn't work on anything with #js literals
- Lumo 1.10.1 doesn't run in NixOS 19.09 HOT 9
- Different startup times for -e vs. stdin HOT 2
- Yarn error when building on Debian Buster x86 (32-bit) HOT 1
- jszip no longer available HOT 7
- Macro expand strangeness HOT 1
- Homebrew lumo package was deleted
- Subtract and divide operators accept zero args HOT 1
- brew install lumo fails HOT 1
- Question: How can I get fipp to work with lumo? HOT 1
- Build option :output-wrapper ignored
- Execution speed of lumo compared to Clojure
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lumo.