This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-25
Channels
- # 100-days-of-code (3)
- # beginners (80)
- # cider (53)
- # cljdoc (9)
- # cljs-dev (66)
- # cljsrn (6)
- # clojure (108)
- # clojure-austin (5)
- # clojure-dusseldorf (1)
- # clojure-italy (9)
- # clojure-losangeles (2)
- # clojure-nl (4)
- # clojure-spec (40)
- # clojure-uk (46)
- # clojurescript (60)
- # cursive (119)
- # datomic (28)
- # emacs (10)
- # events (1)
- # figwheel-main (21)
- # fulcro (16)
- # hyperfiddle (10)
- # immutant (2)
- # leiningen (1)
- # liberator (5)
- # nyc (1)
- # off-topic (36)
- # onyx (4)
- # pedestal (52)
- # portkey (5)
- # re-frame (11)
- # reagent (11)
- # shadow-cljs (46)
- # sql (1)
- # unrepl (2)
doesn’t appear to from the repl, but I’ve never really understood this aspect of cljs
@idiomancy if it's not dynamic
, you can use binding
on it
https://github.com/clojure/clojurescript/blob/4f3707624846a2cf0345859e41370ec172da73c4/src/main/clojure/cljs/analyzer.cljc#L1198
any vim and node repl users run into a problem with println
/ .log console
output not displaying when running code via piggieback?
(i have called (nodejs/enable-util-print!)
)
how can I dispatch on (type) in clojurescript using multimethods? Intuitively I was thinking about (defmulti foo (fn [t] (type t)) (defmethod foo bar/baz-record-type [t] :whatever)
but I cannot get this to dispatch on other than the default.
I believe (I’m not 100% sure on this) that multimethods that dispatch on type only can be replaced with protocols?
so (defprotocol Foo (foo [this]))
, then in the record (defrecord Bar [x y z] Foo (foo [this] (println "I am Bar!" x y z)))
(foo (->Bar 1 2 3))
note that you can also extend the clojure(script) basetypes as well, so you could extend js/String, js/Number, as a default, js/Object
Note that multimethods, once defined (the defmulti
, not the defmethod
) can’t be overwritten. You have to do some special invocation to undefine it first. Perhaps this is what you are experiencing?
It’s so annoying. I can’t remember the syntax on how to undefine them, but it’s possible.
I’m watching ‘David Nolen: Embracing Simpler Tools’ right now. Are slides available for this talk?
Is there a way in clojurescript to compile conditionally depending on target platform ? Something like reader conditionals but for ios and android for instance.
@mfikes lol, true, but I’d love to try some of the things he demoed.
I agree. Joking aside, I watched his talk as well, and had to imagine things. I'm not aware of any slides. (Actually, it looked like a lot of what David did was wing things at the terminal.)
Good point.
Part of the reason why I’m asking is I’m putting together a presentation for a Clojure meetup, and I’m trying to decide how many new concepts I want to use. The demo is mostly figwheel-main, but I’m deciding between lein and CLI deps.
Any popular solutions out there for logging/log aggregation on a client only cljs web app?
Looks like loggly has an endpoint for browsers too. I have mixed experiences with loggly though...
Yeah, im considering sending everything to s3 and then using spectrum or whatever to query it later, but that gets me pretty deep into AWS stack...
depending on your other choices you could also just use the AWS SDK from the browser to log via CloudWatch
@idiomancy I haven't used it with cljs, but one lib I've been tinkering with using both in frontend and (node) backend is pino
, which is an extensible lightweight logging lib that logs in ndjson
format, which is very nice for sending over the wire. So you could set it up to log things back to a server that then aggregates or converts and then aggregates as needed. It also supports loglevels https://github.com/pinojs/pino
It should be pretty easy to wrap from cljs
which tbh is my preference anyway. there are some pre-existing ones for pino though https://github.com/pinojs/pino/blob/master/docs/transports.md#known-transports
hi! quick newbie question: in "(let [news-list @(subscribe [:news])]" what "@" is for?
dereferencing a.. thing. probably an atom (or a ratom if you're in the context of reagent)
Im actually thinking I might just make a simple lambda function to push logs onto s3
yeah, I'd definitely set up the transport as a separate pluggable thing from your logging lib either way
i heard it’s easy to have memory leaks when using cljs and core.async is there a post, or docs, on how to avoid that? if a channel is no longer referenced will it get cleaned up? or do i need to explicitly close all channels i open?
that’s good to hear
i’m building a cljs that will run longer than a typical web app i’m used to building
as long you’re tasteful and moderate with your core.async usage I don’t think this will be a problem
if you do find it to be a problem - Chrome Heap Snapshot can usually spot these problems
the only time I debugged core.async memory issues was when I worked on core.async itself
cool thanks