Fork me on GitHub
#unrepl
<
2017-04-06
>
dominicm09:04:40

@pesterhazy how do you handle multiple ?

cgrand09:04:03

map elisions returns seq of pairs, that put the burden of maintaining context on the client... I should change that

cgrand09:04:53

either return another map or #unrepl/map-entries ([k v] ...)

pesterhazy10:04:55

True haven't looked at kv pairs yet

cgrand11:04:32

Something bothers me about hash maps/sets. It’s kind of a detail but it’s very easy to mess their ordering. If the client parses map into its own maps then the print order depends on hash order of the client and not of the order (and if the map was elided it’s a bit of both).

cgrand11:04:22

So: is asking client repls author to use a custom edn reader ok or... should maps and sets be rendered as #unrepl/map entries ?

thheller11:04:57

@cgrand FWIW in my customFormatters I even attempt to sort the keys of a map

thheller11:04:24

since when inspecting a map I hated the random ordering of keys

thheller11:04:42

which is especially annoying when just looking for a specific key

cgrand11:04:26

example problem: the user evals (into (sorted-set) (range 100)), it renders to #{0 ... 99} but the client reads that and prints #{0 32 64 96 1 33 65 ... 95}

thheller11:04:30

yeah that is why I print the type of the collection as well, sometimes it is useful to know which collection was used

cgrand11:04:04

print-dup territory

thheller12:04:01

no such thing in CLJS

pesterhazy13:04:02

yeah I ran into the fact that printing works differently in cljs than clj

pesterhazy13:04:44

currently I extend IPrintWithWriter, which works

pesterhazy13:04:05

are there alternative printers? maybe I should look into fipp?

cgrand14:04:49

Printing is messy :-(

pesterhazy14:04:54

seems like this could be implemented well in a library

pesterhazy14:04:25

I wouldn't necessarily want to write my own printer but not sure how else to do it for map ellisions

cgrand14:04:53

There are two things that are too often completed: walking and printing.

pesterhazy14:04:47

>>> To achieve success in philosophy would be, to use a contemporary turn of phrase, to 'know one's way around' with respect to all these things, not in that unreflective way in which the centipede of the story knew its way around before it faced the question, 'how do I walk?', but in that reflective way which means that no intellectual holds are barred.

pesterhazy14:04:56

@cgrand, when I close the input stream, unrepl doesn't seem to send a [:fin] message

pesterhazy14:04:19

that would be very useful I think

pesterhazy14:04:58

because after unrepl/start terminates, I get a regular clojure prompt again, user=>

cgrand15:04:19

@pesterhazy can you describe steps to reproduce? I'm confused by your last sentence.

pesterhazy15:04:50

if I run this:

cat src/unrepl/{print.clj,repl.clj} <(echo '(unrepl.repl/start)') - | nc localhost 50505

pesterhazy15:04:08

the last lines of output are

[:unrepl/hello {:session :session330, :actions {:exit (unrepl.repl/exit! :session330), :log-eval (clojure.core/some-> :session330 unrepl.repl/session :log-eval), :log-all (clojure.core/some-> :session330 unrepl.repl/session :log-all), :set-source (unrepl.repl/set-file-line-col :session330 <#C4C63FWP5|unrepl>/param :unrepl/sourcename <#C4C63FWP5|unrepl>/param :unrepl/line <#C4C63FWP5|unrepl>/param :unrepl/column)}}]
[:prompt {:file "unrepl-session", :line 1, clojure.core/*warn-on-reflection* false, clojure.core/*ns* <#C4C63FWP5|unrepl>/ns unrepl.repl}]
nil
unrepl.repl=>

pesterhazy15:04:26

(I just typed ^D in nc)

pesterhazy15:04:52

after unrepl/start finishes, the original repl takes over

pesterhazy15:04:05

then my code tries to interpret that as EDN, which it obviously can't

pesterhazy15:04:29

if I append (write [:fin]) to the end of unrepl.repl/start, I get a signal so I know when the EDN stream ends

pesterhazy15:04:47

i.e. the EDN stream starts with [:unrepl/hello] and ends with [:fin]

cgrand15:04:10

Ok got it: the original repl takes over and prints user=> as its final word before exiting too. Correct?

cgrand15:04:32

Then yes there should be a :bye message.