This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-31
Channels
- # aws (1)
- # beginners (82)
- # boot (7)
- # cider (1)
- # cljs-dev (13)
- # cljsrn (1)
- # clojure (37)
- # clojure-dev (5)
- # clojure-italy (5)
- # clojure-spec (9)
- # clojure-uk (8)
- # clojurescript (110)
- # community-development (6)
- # datomic (1)
- # devcards (1)
- # fulcro (12)
- # lein-figwheel (1)
- # off-topic (34)
- # portkey (24)
- # protorepl (25)
- # re-frame (4)
- # reagent (29)
- # shadow-cljs (8)
- # spacemacs (11)
- # specter (3)
- # unrepl (1)
- # vim (1)
Why is 'callback hell' considered to be so bad? "Reagent + functiknal reactive programming + js callback hell", in my experience, is easier to debug than core.async.
a bit late on this, but you can see Rich explaining it here: https://www.infoq.com/presentations/core-async-clojure
It usually leads to reverse composition, basically; a difficult-to-read and verbose flow. Nothing inherently wrong, but when you combine it with Javascript and typical JS devs, you get...
call(1, 2, 3, function(a, b) { c = a + b; call2(4, 5, 6, function(d, e) { ...
@qqq i’m starting to wonder the same thing myself. core.async is particularly hard to debug on cljs since it shears off your stack trace. i’ve been meaning to play around to see if clojurescript is inherently flexible enough to do what i need (which isn’t much) without having the indentation hell
@fellshard: maybe my cljs code isn't complicated enough, but it rately gets that level. most of the time it goes:
register_js_handler() {
stuff that modifies an atom;
}
then, that atom is reactive, so changing that atom triggers re-reners via reagent/reactI'm speaking mostly of why callback hell gets a bad rap; doesn't mean it must be bad, and in languages designed for it, it works perfectly well. It's a combination of Javascript itself having horrid lambda syntax and the immaturity of many JS devs that gives it that bad rap.
for me, i often have 3 or 4 async things in a row. if you use call backs, the indentation gets pushed right, or you write a bunch of functions with strained names and they have to be written backwards in time. I feel like there must be some sort of threading macro like magic that will fix this for me, but it might not really be possible without better language support
Hence why it requires languages designed for it. Works extremely well with currying or pipelines.
ccw was quite popular back in the days. I guess cursive just ate its marketshare over time.
I would assume as much as there are people that dislike the JVM because its "clunky" they even dislike eclipse more, because its "bloated and slow".
@sveri: Interesting, I didn't realize there was a significant portion of Java users that hate Eclipse.
@qqq while there surely are java users that hate eclipse I was talking more of users of different programming languages that come to clojure.
@gklijs I have a DelayedFn I use:
public class DelayedFn implements IFn {
private final String namespace;
private final String name;
private volatile IFn delegate = null;
public DelayedFn(String namespace, String name) {
this.namespace = namespace;
this.name = name;
}
@Override
public Object invoke() {
return getDelegate().invoke();
}
@Override
public Object invoke(Object o) {
return getDelegate().invoke(o);
}
... etc etc ...
@Override
public Object applyTo(ISeq iSeq) {
return getDelegate().applyTo(iSeq);
}
@Override
public Object call() throws Exception {
return getDelegate().call();
}
@Override
public void run() {
getDelegate().run();
}
private IFn getDelegate() {
// See
IFn result = delegate;
if (result == null) {
synchronized (this) {
result = delegate;
if (result == null) {
if (!"clojure.core".equals(namespace)) {
REQUIRE.invoke(asSym(namespace));
}
delegate = var(namespace, name);
result = delegate;
}
}
}
return result;
}
}
Then I have a static function which constructs them, so I use:
val callClojure = delay("my.namespace", "some-var")
...
val result = callClojure.invoke(a, b, c) as Something
@cfleming thanks I just have one namespace, and a couple of functions, but when I start using more, DelayedFn is nice.
new
is reserved by clojure for java interop; is there a three letter word meaning something similar ?`
What is the obsession of Eclipse, Netbeans, JetBrains with XMLconfig files? It seems like I can not build a plugin in any of them without lots of xml files and lots of Java wrappers.
data > code
same in Clojure, it's just that XML is a bit more verbose
Kotlin is a nice language, succinct and expressive. But, as a lot of other languages, it lacks a good REPL. Or any REPL. Some complain about the REPL startup time, but miss that most web frameworks on the JVM have a longer deploy time for every change than the startup time of the REPL.