This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-23
Channels
- # announcements (2)
- # beginners (246)
- # boot-dev (1)
- # braveandtrue (3)
- # calva (13)
- # cider (26)
- # cljs-dev (6)
- # clojure (75)
- # clojure-finland (4)
- # clojure-germany (39)
- # clojure-italy (1)
- # clojure-mexico (1)
- # clojure-nl (14)
- # clojure-spec (61)
- # clojure-uk (104)
- # clojurescript (125)
- # cursive (20)
- # datomic (1)
- # emacs (2)
- # figwheel-main (91)
- # fulcro (29)
- # graphql (9)
- # jobs (3)
- # jobs-discuss (9)
- # juxt (13)
- # liberator (2)
- # luminus (1)
- # off-topic (15)
- # parinfer (8)
- # re-frame (70)
- # reagent (35)
- # reitit (24)
- # remote-jobs (5)
- # ring-swagger (3)
- # shadow-cljs (127)
- # spacemacs (34)
- # yada (6)
måning
mmmmmmmmmmmorning
Can anyone here explain this?
zib.handler.resource> (java.net.URI. "")
#object[java.net.URI 0x17404268 ""]
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en-GB"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta href="https://play.google.com/?hl=en&tab=w8">Play</a> ;google.jsc && google.jsc.m(m);})();..... </script></div></body></html>
plain old repl doesn’t do it. Looks like it was caused by this: https://github.com/clojure-emacs/cider-nrepl/commit/55cd4bf5ea3a699688fb06515537ddcc17e9d40f
Anyone up for telling me how I am being an idiot wrt to these routes?
(defn admin-routes
"Routes for the 'foundation' admin section"
[db]
["/admin"
[
["" (index)]
["/organisation"
[
["" (organisation-index db)]
["/add" (organisation-add db)]
["/logo" (organisation-logo db)]
["/:organisation-id" (organisation-detail db)]]]
["/user"
[
["" (user-index db)]
["/:user-id" (user-detail db)]]]
["/setup"
[
["" (setup-index)]
["/setup-db" (setup-db db)]
["/setup-reset-baphomet" (reset-db db)]]]]])
Ah, you replied in a thread - I never notice that, when people do that... Thanks for answering, I was not ignoring you 🙂
@maleghast is that yada?
@thomas - Well the routes are Bidi routes, but I am using them to target Yada resources.
Bore da pawb
Turns out cider does this ⬆️
feels wrong to me, the URI
is a reference. I could understand that if I did the equivalent of @(URI. "
yeah its exactly that
https://github.com/clojure-emacs/cider-nrepl/commit/55cd4bf5ea3a699688fb06515537ddcc17e9d40f
M-x cider-repl-toggle-content-types
Don’t get me wrong I think the features kinda cute; but usually it just results in your REPL filing with garbage (i.e. HTML output); and I think the operation is done on the wrong thing; the URI
is not the image, it’s the pointer to the image. This should only really happen on java.awt.BufferedImage
s and the like… i.e. if you deref
the URI; (though I don’t think Deref is actually a protocol in clojure — but is in cljs)
Do I need to be using GUI Emacs as well..? In my Emacs buffer I just get #[object java.net.URI ...] etc.
Yeah… would probably also need to be compiled with image support etc…
@maleghast do /admin/organisation
and /admin/organisation/add
match ok ?
the id is a string representation of a UUID, e.g. -> 0ac7f61d-657d-5e37-9589-94f41079508b
@maleghast i think u have ur keywords as string
https://github.com/metosin/clojure-bootcamp/blob/master/bidi-example/src/bidi_example/server.clj#L18
Yeah, I have re-defined it now: [["/" :organisation-id] (organisation-detail db)]]]
Yeah, I need to do that one as well, but I've not implemented the Yada resource or the template for that one yet. Still I will update the route now.
TIL: Throwable->map
considered harmful
we were using it to make some exceptions serializable... but we ended up with undeserializable tags in the data anyway
since it's just for error investigation purposes we'll switch to printing the exceptions to a string and serializing that instead
clojure core is not very careful about making things serializable. prepl has been criticized for this. Compared with other edn repls like unrepl, which do the right thing(tm)
@bronsa the output of pr-str
will get put in a structure which gets EDN serialized... we don't need to do anything apart from visually inspect the exceptions
I don't get what you mean when you say that the output of Throwable->map
is not serializable -- does it generate unreadable symbols?
@bronsa i don't think it's Throwable->map
's fault - it's probably an ex-info
with some unserializable stuff in its map
there were #object
tags in the output
i guess i didn't think through the implication of using Throwable->map
carefully
FWIW
user=> (binding [*default-data-reader-fn* tagged-literal] (read-string (pr-str (Throwable->map (ex-info "" {:k (reify Object)})))))
#error {:cause "", :data {:k #object [user$eval171$reify__172 896138248 "user$eval171$reify__172@3569fc08"]}, :via [{:type clojure.lang.ExceptionInfo, :message "", :data {:k #object [user$eval171$reify__172 896138248 "user$eval171$reify__172@3569fc08"]}, :at [clojure.core$ex_info invokeStatic "core.clj" 4754]}], :trace [[clojure.core$ex_info invokeStatic "core.clj" 4754] [clojure.core$ex_info invoke "core.clj" 4754] [user$eval171 invokeStatic "NO_SOURCE_FILE" 15] [user$eval171 invoke "NO_SOURCE_FILE" 15] [clojure.lang.Compiler eval "Compiler.java" 7069] [clojure.lang.Compiler eval "Compiler.java" 7032] [clojure.core$eval invokeStatic "core.clj" 3206] [clojure.core$eval invoke "core.clj" 3202] [clojure.main$repl$read_eval_print__8720$fn__8723 invoke "main.clj" 243] [clojure.main$repl$read_eval_print__8720 invoke "main.clj" 243] [clojure.main$repl$fn__8729 invoke "main.clj" 261] [clojure.main$repl invokeStatic "main.clj" 261] [clojure.main$repl_opt invokeStatic "main.clj" 325] [clojure.main$main invokeStatic "main.clj" 424] [clojure.main$main doInvoke "main.clj" 387] [clojure.lang.RestFn invoke "RestFn.java" 397] [clojure.lang.AFn applyToHelper "AFn.java" 152] [clojure.lang.RestFn applyTo "RestFn.java" 132] [clojure.lang.Var applyTo "Var.java" 702] [clojure.main main "main.java" 37]]}
ah, neat @bronsa - i wasn't aware of tagged-literal
*default-data-reader-fn*
should be bound to tagged-literal
by default, really, no idea why they didn't do it
Compatibility, IIRC tagged-literal
was introduced in 1.7, *default-data-reader-fn*
1.5.
right yeah, my gripe is that
- they didn't add tagged-literal
at the same time that tagged literals were introduced (which tools.reader
did)
- they didn't bind *defafult-data-reader-fn*
when they did introduce tagged-literal
compatibility is not a valid reason, setting a root binding to a previously unbound var is not going to break any existing code
it is breaking though isn’t it? The difference between an exception being raised and it letting things through.
Yeah I did ummm and errr a little about this too, but in this case it is changing existing documented behaviour though. That var previously stored a root value of nil
and read when it’s nil is promised to throw an exception.
I’d argue because it’s been documented this isn’t accretion, it’s taking something away and replacing it with something else.
Oh man i need to do this
Those pesky # object