Support PREPL format
viebel opened this issue · 6 comments
suggested by @raymcdermott
The motivation
I would like the same client code for the remote PREPL and the self-hosted PREPL
it’s just trying to make things conform to some standard mechanisms
so that whatever works with the other PREPLs will also work self-hosted
The implemenation details
that we could make a wrapper around the js/eval stuff that back the same data as the PREPL
the way I think about it is that the socket server is just a means to connect to a REPL
and the PREPL can distinguish between output and values <--- the main point of PREPL imho
so you only ever get one value per eval
so we need some key per eval (can just be a simple atom counter)
and then no interleaving
or something like that
main thing is I want to be able to use the PREPL data structures in bootstrapped CLJS
Here is a spec for a PREPL map:
(def tags #{:ret :out :err :tap})
(spec/def ::tag (spec/with-gen keyword? #(spec/gen tags)))
(spec/def ::val ::general/string-data?)
(spec/def ::ns ::general/string-data?)
(spec/def ::ms int?)
(spec/def ::form ::general/string-data?)
(def phase-indicators #{:read-source :macro-syntax-check :macroexpansion :compile-syntax-check
:compilation :execution :read-eval-result :print-eval-result})
(spec/def ::phase-error
(spec/with-gen keyword? #(spec/gen phase-indicators)))
(spec/def ::eval-result
(spec/keys :req-un [::tag ::val]
:opt-un [::ms ::ns ::form ::phase-error]))
each :form
must be evaluated and assigned a :val
klipse-clj
should add a new eval function that returns a list of maps (and it will work because each map will have a :form
and a tag (eg :ret
or :out
) and a :val
)
@raymcdermott is the description of the issue accurate enough?
Feel free to add more details
This issue is now published on WorksHub. If you would like to work on this issue you can
start work on the WorksHub Issue Details page.
@Verdinjoshua26 started working on this issue via WorksHub.