Fork me on GitHub
#unrepl
<
2017-11-24
>
volrath12:11:39

@cgrand did you notice the elision for letters seems a bit weird? shows the first 10, then the rest

volrath12:11:02

doesn't stop at 20... not sure why, maybe because I'm modifying the print limits in the documentation

cgrand12:11:08

There are several unicode glyphs if you want a smaller button

volrath12:11:50

I tried it, but it's too small! difficult to click 😕

volrath12:11:41

but i examine unrepl.print/print-length and it's 80.. maybe is the same bug we were discussing on github

cgrand12:11:44

do use aux for elision resolution? what are print-limits settings on it?

volrath12:11:59

I suppose I'm messing with *coll-length*

volrath12:11:07

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...

volrath12:11:20

but why does it elide after the first 10?

cgrand13:11:15

> but why does it elide after the first 10? Do you mean why it doesn’t elide after the first 10

volrath13:11:35

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?

volrath13:11:15

I haven't looked too much into elision implementation, so I don't..

cgrand13:11:30

initial elision occur on user while elision of the resolved elision occurs on aux

volrath13:11:46

should I use user for resolving elisions then?

cgrand13:11:01

then you would mess with *1 *2 etc.

cgrand13:11:34

and user wouldn’t able to browse past result whilst something is evaling

volrath13:11:40

yes that's what I thought, but then how can I keep them synced?

volrath13:11:29

If we want print-length at, say, 25.. the first result will always be elided at 10, right?

cgrand13:11:38

depends on which conn you issue print-limits

baptiste-from-paris13:11:23

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 😞

volrath13:11:20

yes, but it's kinda the same problem as resolving elisions on user, setting print-limits in user would also mess *1 *2 *3...

volrath13:11:40

but I guess it's not a big deal for now

pesterhazy13:11:31

@baptiste-from-paris can you point to a line in the code?

baptiste-from-paris13:11:09

unravel.network ns line 47 => (when-let [[v rst] (ul/safe-read-string (.toString buf))]

cgrand13:11:00

@volrath, wait I’ve an ace into my sleeve! unrepl/do!

volrath13:11:46

I don't follow 😳

volrath13:11:00

how would you use it?

cgrand13:11:05

now I realize that set-file-line-col doesn’t quite work

cgrand13:11:25

well it works but only from user maybe it’s ok

pesterhazy13:11:33

read-string throws an exception if it cannot read the string, perhaps because it has unbalanced parens

pesterhazy13:11:14

hm or maybe it doesn't, wait...

pesterhazy13:11:58

maybe that used to be the case (hence the name) but currently "safe" is not a good name for the function 🙂

pesterhazy13:11:25

it basically reads the next form, returns that PLUS the rest of the string

pesterhazy13:11:25

it's used because it's a stream of EDN values

baptiste-from-paris13:11:26

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)))]))

pesterhazy13:11:44

this is a sort of implicit parameter for the reader

pesterhazy13:11:12

it makes sure that tagged literals are returned as defrecords

pesterhazy13:11:36

binding sets up a dynamic variable context (think of it as setting the variable, then restoring it at the end of the block)

baptiste-from-paris13:11:28

thanks ! it makes sure that tagged literals are returned as defrecords => that’s what I was looking for

pesterhazy13:11:08

there's also special handling for elisions and vars (these are printed in a special way)

cgrand13:11:13

@volrath there’s definitely something fishy

pesterhazy14:11:27

sure thing! feel free to ask question about the code btw

cgrand14:11:54

@volrath emitting commands on user is baaaaad (first rule of unrepl), unrepl/do is thus an abomination,

volrath14:11:27

haha noted 😐

cgrand14:11:01

the problem is that we are trying to modify dynamic bindings of one connection from another one

volrath14:11:10

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

volrath14:11:42

i.e. If i require a namespace in conn1, I can use it in conn2 without requiring it

volrath14:11:17

plus, everything that I define in conn1, I can use in conn2

cgrand14:11:09

yes they are not isolated clojure instances

volrath14:11:11

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

cgrand14:11:16

(boot pods)

cgrand14:11:53

@pesterhazy in Chez how do you transition to viewing the whole form when you see only the first?

pesterhazy14:11:38

it's really quite natural - that's readline's default binding for "redraw the current line"

pesterhazy14:11:17

also, using the down key you can cycle through the lines (not sure how useful that feature is)

cgrand14:11:19

I’m not sure all potential users are so readline experts

pesterhazy14:11:47

Alt-up and Alt-down navigates history on a strict first-line-only basis

pesterhazy14:11:18

are you on macos? it's pretty easy to install brew install --HEAD michaelballantyne/homebrew-chez/chez-scheme

pesterhazy14:11:28

(I think you need quartz too for some reason)

pesterhazy14:11:03

not all users are readline nerds, but many command line powerusers are - and we're trying to reach those

pesterhazy14:11:46

Question: right now unravel starts in the unrepl.replG__20 ns - should we make sure the repl starts in user?

pesterhazy14:11:56

Or is it better to isolate each session?

cgrand14:11:43

unrepl.replG__20is wrong and fixed in recent blobs (eg in multiline it starts on user)

baptiste-from-paris14:11:57

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-paris14:11:44

an unrepl spec one ?

cgrand14:11:46

maybe we can rename user to get-your-own-ns

pesterhazy14:11:49

@baptiste-from-paris like this (read-string "[:foo] [:bar]")

pesterhazy14:11:05

unrepl.replG__20=> (read-string "[:foo] [:bar]")
[:foo]

pesterhazy14:11:36

this is clojure's read-string, the function is unravel is similar except that it returns the remaining string as well

pesterhazy14:11:46

what do you mean by spec?

baptiste-from-paris14:11:52

yes I know what read-string is supposed to do, but the kind of message that it reads follow the unrepl protocol

pesterhazy14:11:03

yeah exactly

baptiste-from-paris14:11:13

that’s what I was trying to ask ^^

pesterhazy14:11:19

you can check by passing --debug - it will print all messages

pesterhazy14:11:29

at the cost of making it unusable because of all the noise 🙂

baptiste-from-paris14:11:52

Yes I’ve seen it !

pesterhazy14:11:55

@cgrand you mean like passing a --init-ns my.core option?

cgrand14:11:42

no, I didn’t mean much that users in shared env should have the habit to swicth ns

cgrand14:11:54

maybe a conf file

pesterhazy14:11:24

it would be cool to have a --debug-out argument, so you can tail that file in another terminal

pesterhazy14:11:40

you can see debug messages and still actually use the prompt

baptiste-from-paris14:11:00

you mean a read-only terminal ?

cgrand14:11:27

yeah he means tail -f debug.log in another term

baptiste-from-paris14:11:31

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)))

pesterhazy14:11:08

yeah stderr would work too, true

volrath14:11:27

@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

pesterhazy14:11:32

oh your point is that it already writes to stderr, forgot about that!

cgrand14:11:49

0-line feature achieved!

pesterhazy14:11:04

the best feature is the one that doesn't have to be implemented

pesterhazy15:11:06

@cgrand can't reproduce the autodoc issue right now?!

cgrand15:11:41

me neither

cgrand15:11:02

I’ve never really qualified the issue, so it may have been a dev glitch

pesterhazy15:11:05

let's consider it 0-line fixed then

cgrand15:11:27

@pesterhazy ^^ not like Chez

pesterhazy15:11:17

one more question about the PR ^^

pesterhazy15:11:27

@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?

pesterhazy15:11:54

@cgrand, latest blob seems to break the tests: https://github.com/Unrepl/unravel/pull/40

Error: stream.push() after EOF

pesterhazy15:11:26

it also returns #unrepl/ns user - should I just unwrap that on the client side?

volrath15:11:43

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

cgrand21:11:18

Quoting intend to make it possible to not have display glitches when working on unrepl source code – granted it’s a niche

cgrand15:11:59

s**t indeed I messed up with unrepl/quote

cgrand15:11:15

better but still broken

cgrand17:11:59

I have tweaked the packed printer, it gives interesting results.

pesterhazy17:11:09

@cgrand, what's the advantage over clojure.pprint?

cgrand17:11:10

=> (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

cgrand17:11:28

=> (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}}}

cgrand17:11:18

=> (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}}}

cgrand17:11:30

Mine is the middle one

cgrand17:11:52

It’s relatively small, open (like fipp it works on a stream of spans)

pesterhazy18:11:32

pretty cool!

pesterhazy18:11:49

It would be great to have pluggable printers in unravel

pesterhazy18:11:39

You could even switch the printer "live"

pesterhazy18:11:33

"That's not readable - let me switch to packed layout"

pesterhazy18:11:42

I've wished for that many times

cgrand20:11:38

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.

cgrand21:11:28

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