This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (16)
- # babashka (10)
- # beginners (80)
- # calva (18)
- # cider (10)
- # clojure (96)
- # clojure-austin (1)
- # clojure-europe (52)
- # clojure-france (6)
- # clojure-germany (2)
- # clojure-italy (4)
- # clojure-nl (4)
- # clojure-seattle (3)
- # clojure-spec (4)
- # clojure-uk (25)
- # clojurescript (97)
- # community-development (2)
- # cursive (7)
- # datomic (13)
- # figwheel-main (5)
- # fulcro (13)
- # inf-clojure (1)
- # jobs (3)
- # off-topic (33)
- # pathom (10)
- # polylith (8)
- # re-frame (7)
- # reitit (8)
- # releases (1)
- # reveal (2)
- # ring (4)
- # ring-swagger (1)
- # sci (6)
- # shadow-cljs (102)
- # slack-help (1)
- # spacemacs (28)
- # tools-deps (9)
- # vim (1)
- # xtdb (3)
@folcon i don't like core.async for promise-like things - it's fine for streams. promesa is a good library - we've been using it concert with
funcool/cats for promise stuff for ages
for one thing, error/exception handling is much more straightforward with promises than with core.async promise chans
Is there any good examples on using it? I've not worked with promises much. For context, I'm using it in a function within a re-frame app, I was initially hoping to just have it resolve within a function call, ie it returns to the caller, but it seems like I have to wait for the promise to resolve and use a callback, so for the moment I've had to add in a new re-frame event handler to act as a point to receive the callback from the core async channel. It's annoyingly made the logic there a lot more complicated 😞...
you would have the same issue with a core.async chan - API requests always have to be decomposed into an HTTP fx and a response-handling event
the way we deal with it is to have a generic API fx wich takes both a success event-template and an error event-template
then the promise handler or core.async take op handler either conj's the success value to the success event-template, or the error value to the error event-template and dispatches that
whether you use core.async or promises, it's all just gloss over callbacks... that's the js life 😃
anyone have a nice way of preventing multimethod impls being removed from namespace
:require decls by
cljr-clean-ns ? i'm currently putting a
def into the requiring namespace with a bunch of refs to vars in the impl namespaces, but it looks weird
@mccraigmccraig: I used to put
(require 'foo.ns) forms beneath the
ns declaration as a convention to avoid this; when I was including a namespace for a side effect.
However I now follow the convention of putting a
(:require [foo.ns]) form into the ns form itself… i.e. no
:as etc. Some newer tooling, like clj-kondo etc knows to interpret this style of require as one to leave alone, for side effects like multimethods protocol extensions etc…
Can’t recall if
cljr-clean-ns has been updated or not to handle it though.
cljr-clean-ns does still remove the apparently unused requires... i didn't know that clj-kondo didn't annotate an ns form with no
:as though - that's nice
Yeah there was a big debate on how to handle it a few years ago here: https://github.com/clj-kondo/clj-kondo/issues/241 I think the above is the best convention for handling it.
huh, so they all agreed on missing
:as meaning it's side effecting - but that behaviour hasn't made it as far as
refactor-nrepl, at least not in v2.5.0
Yeah it’s not updated very frequently… Might be worth adding an issue for it, I suspect it would be a pretty simple patch to this function: https://github.com/clojure-emacs/refactor-nrepl/blob/dbafd6e686402dc020d7026e21ee556812fc51da/src/refactor_nrepl/ns/prune_dependencies.clj#L118-L122
Created issue for it here: https://github.com/clojure-emacs/refactor-nrepl/issues/292
I've got an odd issue happening at the moment, perhaps someone has seen it before?
I'm using figwheel through webpack and the source-code generated has got mangled names, but when I breakpoint in the debugger, the names provided aren't mangled at all. Any ideas what could be happening? The best I've got is that for some reason some of the code is being mangled, but not others and I have no idea why...
I'm currently using lots of
js-invoke to keep the names unmangled, but it's not exactly the best...
Anyone else seen inconsistent behavior from minification?