We use cookies and other tracking technologies to improve your browsing experience on our site, analyze site traffic, and understand where our audience is coming from. To find out more, please read our privacy policy.

By choosing 'I Accept', you consent to our use of cookies and other tracking technologies.

We use cookies and other tracking technologies to improve your browsing experience on our site, analyze site traffic, and understand where our audience is coming from. To find out more, please read our privacy policy.

By choosing 'I Accept', you consent to our use of cookies and other tracking technologies. Less

We use cookies and other tracking technologies... More

Login or register
to apply for this job!

Login or register
to save this job!

Login or register to start contributing with an article!

Login or register
to see more jobs from this company!

Login or register
to boost this post!

Show some love to the author of this blog by giving their post some rocket fuel 🚀.

Login or register to search for your ideal job!

Login or register to start working on this issue!

Engineers who find a new job through JavaScript Works average a 15% increase in salary 🚀

Support PREPL format

Issue Open
Pull requests: 0
Contributors: 0
Level: Intermediate
  • Clojure
Issue Open
Pull requests: 0
Contributors: 0
Level: Intermediate
  • Clojure

On GitHub

Clojurescript selfhost library
More info >

Issue posted by: 
viebel's avatar

Yehonathan Sharvit

Description

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)

    Use Open Source Issues to hire or get hired

    On GitHub

    Clojurescript selfhost library
    More info >

    Issue posted by: 
    viebel's avatar

    Yehonathan Sharvit

    Use Open Source Issues to hire or get hired

    Support PREPL format
    View on GitHub