@pesterhazy how do you handle multiple …
?
@dominicm ^^
map elisions returns seq of pairs, that put the burden of maintaining context on the client... I should change that
either return another map or #unrepl/map-entries ([k v] ...)
True haven't looked at kv pairs yet
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).
So: is asking client repls author to use a custom edn reader ok or... should maps and sets be rendered as #unrepl/map entries
?
@cgrand FWIW in my customFormatters I even attempt to sort the keys of a map
since when inspecting a map I hated the random ordering of keys
which is especially annoying when just looking for a specific key
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}
yeah that is why I print the type
of the collection as well, sometimes it is useful to know which collection was used
print-dup
territory
no such thing in CLJS
yeah I ran into the fact that printing works differently in cljs than clj
currently I extend IPrintWithWriter, which works
are there alternative printers? maybe I should look into fipp?
Printing is messy :-(
seems like this could be implemented well in a library
I wouldn't necessarily want to write my own printer but not sure how else to do it for map ellisions
There are two things that are too often completed: walking and printing.
>>> 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.
@cgrand, when I close the input stream, unrepl doesn't seem to send a [:fin]
message
that would be very useful I think
because after unrepl/start
terminates, I get a regular clojure prompt again, user=>
@pesterhazy can you describe steps to reproduce? I'm confused by your last sentence.
sure
if I run this:
cat src/unrepl/{print.clj,repl.clj} <(echo '(unrepl.repl/start)') - | nc localhost 50505
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=>
(I just typed ^D in nc)
after unrepl/start
finishes, the original repl takes over
then my code tries to interpret that as EDN, which it obviously can't
if I append (write [:fin])
to the end of unrepl.repl/start, I get a signal so I know when the EDN stream ends
i.e. the EDN stream starts with [:unrepl/hello]
and ends with [:fin]
Ok got it: the original repl takes over and prints user=> as its final word before exiting too. Correct?
Then yes there should be a :bye message.
correct