@cgrand did you notice the elision for letters
seems a bit weird? shows the first 10, then the rest
doesn't stop at 20... not sure why, maybe because I'm modifying the print limits in the documentation
There are several unicode glyphs if you want a smaller button …
but i examine unrepl.print/print-length and it's 80.. maybe is the same bug we were discussing on github
do use aux
for elision resolution? what are print-limits settings on it?
I suppose I'm messing with *coll-length*
yes I do
I restart them after getting the doc to whatever bak#
was, I haven't checked if it's done correctly though... I'll take a look later...
but why does it elide after the first 10?
I tried it, but it's too small! difficult to click 😕
> but why does it elide after the first 10? Do you mean why it doesn’t elide after the first 10
actually I meant: why does it elide the first 10? If the print-limits were in fact left in MAX_VALUE, shouldn't it return the whole 26 letters at once?
I haven't looked too much into elision implementation, so I don't..
initial elision occur on user
while elision of the resolved elision occurs on aux
ah..
should I use user
for resolving elisions then?
then you would mess with *1 *2 etc.
and user wouldn’t able to browse past result whilst something is evaling
yes that's what I thought, but then how can I keep them synced?
If we want print-length at, say, 25.. the first result will always be elided at 10, right?
depends on which conn you issue print-limits
if you guys have some time for some basic stuff I would very grateful
I got how socket-connector
work and why you use make-strip
I am struggling to understant the safe-read-string
part 😞
yes, but it's kinda the same problem as resolving elisions on user
, setting print-limits in user
would also mess *1 *2 *3...
but I guess it's not a big deal for now
@baptiste-from-paris can you point to a line in the code?
unravel.network
ns line 47 => (when-let [[v rst] (ul/safe-read-string (.toString buf))]
@volrath, wait I’ve an ace into my sleeve! unrepl/do
!
read-string
throws an exception if it cannot read the string, perhaps because it has unbalanced parens
hm or maybe it doesn't, wait...
maybe that used to be the case (hence the name) but currently "safe" is not a good name for the function 🙂
it basically reads the next form, returns that PLUS the rest of the string
it's used because it's a stream of EDN values
it might be newbish to ask that but what this binding is actually doing ?
(binding [reader/*default-data-reader-fn* tagged-literal
reader/*data-readers* ut/tag-map]
(let [r (reader-types/string-push-back-reader s)]
[(reader/read r)
(uu/unblank (clojure.string/trim (read-chars r)))]))
binding *
this is a sort of implicit parameter for the reader
I don't follow 😳
how would you use it?
it makes sure that tagged literals are returned as defrecords
binding sets up a dynamic variable context (think of it as setting the variable, then restoring it at the end of the block)
thanks ! it makes sure that tagged literals are returned as defrecords => that’s what I was looking for
there's also special handling for elisions and vars (these are printed in a special way)
@volrath there’s definitely something fishy
now I realize that set-file-line-col
doesn’t quite work
well it works but only from user
maybe it’s ok
thanks @pesterhazy
sure thing! feel free to ask question about the code btw
thanks !
@volrath emitting commands on user
is baaaaad (first rule of unrepl), unrepl/do
is thus an abomination,
haha noted 😐
the problem is that we are trying to modify dynamic bindings of one connection from another one
right.. don't they all share a common state? tbh I have very little insight of the deep ends of unrepl, but I've noticed that If I open two user connections to the same socket repl, they share state
i.e. If i require a namespace in conn1, I can use it in conn2 without requiring it
plus, everything that I define in conn1, I can use in conn2
yes they are not isolated clojure instances
now, I'm guessing that's mostly because in this scenario, both conns are on user
.. but couldn't we just create a aux/tooling namespace that unrepl knows to check for common variables
(boot pods)
@pesterhazy in Chez how do you transition to viewing the whole form when you see only the first?
^L
it's really quite natural - that's readline's default binding for "redraw the current line"
also, using the down key you can cycle through the lines (not sure how useful that feature is)
I’m not sure all potential users are so readline experts
Alt-up and Alt-down navigates history on a strict first-line-only basis
are you on macos? it's pretty easy to install brew install --HEAD michaelballantyne/homebrew-chez/chez-scheme
(I think you need quartz too for some reason)
not all users are readline nerds, but many command line powerusers are - and we're trying to reach those
Question: right now unravel starts in the unrepl.replG__20
ns - should we make sure the repl starts in user
?
Or is it better to isolate each session?
unrepl.replG__20
is wrong and fixed in recent blobs (eg in multiline it starts on user)
so @pesterhazy, to be clear, the safe-read-string
transforms input text from unrepl
into it’s cljs
form which where you can process
it by following the unrepl
protocol right ?
@baptiste-from-paris yeah it reads a form
an unrepl
spec one ?
maybe we can rename user
to get-your-own-ns
@baptiste-from-paris like this (read-string "[:foo] [:bar]")
unrepl.replG__20=> (read-string "[:foo] [:bar]")
[:foo]
this is clojure's read-string, the function is unravel is similar except that it returns the remaining string as well
what do you mean by spec?
yes I know what read-string is supposed to do, but the kind of message that it reads follow the unrepl protocol
yeah exactly
that’s what I was trying to ask ^^
you can check by passing --debug
- it will print all messages
at the cost of making it unusable because of all the noise 🙂
Yes I’ve seen it !
@cgrand you mean like passing a --init-ns my.core
option?
thx
it would be cool to have a --debug-out
argument, so you can tail that file in another terminal
you can see debug messages and still actually use the prompt
no, I didn’t mean much that users in shared env should have the habit to swicth ns
maybe a conf file
you mean a read-only terminal ?
yeah he means tail -f debug.log
in another term
yep
you could pipe out to a file then
(defn err-prn
"Print directly to stderr, circumventing *out*"
[& args]
;; TODO: flush?
(.write js/process.stderr (apply prn-str args)))
yeah stderr would work too, true
@pesterhazy when I was working on the side loader and copying from unravel's sideloader branch, I used to do: ./scripts/run localhost 5555 2> debug.log
then tail that.. it works. definitely easier with an argument though
oh your point is that it already writes to stderr, forgot about that!
sweet
0-line feature achieved!
the best feature is the one that doesn't have to be implemented
hahaha
😂
@cgrand can't reproduce the autodoc issue right now?!
@pesterhazy ^^ not like Chez
me neither
I’ve never really qualified the issue, so it may have been a dev glitch
let's consider it 0-line fixed then
one more question about the PR ^^
@cgrand, do you commit a new blob to the repo when you update unrepl's master? Or are consumers expected to run lein unrepl-make-blob
themselves?
@cgrand, latest blob seems to break the tests: https://github.com/Unrepl/unravel/pull/40
Error: stream.push() after EOF
it also returns #unrepl/ns user
- should I just unwrap that on the client side?
latest blob has a new #unrepl/quote tag that, tbh, i don't know what is it for haha, so I'm on master~1
hehe
s**t indeed I messed up with unrepl/quote
better but still broken
I have tweaked the packed printer, it gives interesting results.
@cgrand, what's the advantage over clojure.pprint?
=> (binding [clojure.pprint/*print-right-margin* 30]
(clojure.pprint/pprint {:a :b :c {:e :f :g :h :i :j :k :l} :m :n :o {:p {:q :r :s :t}}}))
{:a :b,
:c
{:e :f,
:g :h,
:i :j,
:k :l},
:m :n,
:o {:p {:q :r, :s :t}}}
nil
=> (pprint {:a :b :c {:e :f :g :h :i :j :k :l} :m :n :o {:p {:q :r :s :t}}} :width 30)
{:a :b, :c {:e :f, :g :h,
:i :j, :k :l},
:m :n, :o {:p {:q :r, :s :t}}}
=> (czprint {:a :b :c {:e :f :g :h :i :j :k :l} :m :n :o {:p {:q :r :s :t}}} 30 {:map {:nl-separator? true}})
{:a :b,
:c {:e :f,
:g :h,
:i :j,
:k :l},
:m :n,
:o {:p {:q :r, :s :t}}}
Mine is the middle one
It’s relatively small, open (like fipp it works on a stream of spans)
pretty cool!
It would be great to have pluggable printers in unravel
You could even switch the printer "live"
"That's not readable - let me switch to packed layout"
I've wished for that many times
clojure.pprint doesn’t give us enough control (eg elisions rendering). Both fipp and packed work on an intermediate representation. I believe that such an intermediate representation is a good integration point.
Quoting intend to make it possible to not have display glitches when working on unrepl source code – granted it’s a niche
There are three stages: 1/ data -> spans (`spans`) 2/ spans -> layout (`layout`) 3/ layout -> io (`render`) The main stage is the second one and has simple inputs and outputs