This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-24
Channels
- # announcements (3)
- # babashka (47)
- # beginners (40)
- # biff (21)
- # calva (12)
- # cider (2)
- # clj-kondo (31)
- # cljsrn (8)
- # clojure (14)
- # clojure-berlin (2)
- # clojure-conj (1)
- # clojure-dev (24)
- # clojure-europe (84)
- # clojure-italy (8)
- # clojure-nl (1)
- # clojure-spec (1)
- # clojure-sweden (2)
- # clojure-uk (2)
- # clojurescript (34)
- # clr (3)
- # community-development (1)
- # cursive (14)
- # datalevin (8)
- # datomic (5)
- # defnpodcast (2)
- # dev-tooling (1)
- # etaoin (4)
- # events (3)
- # fulcro (26)
- # graphql (3)
- # honeysql (6)
- # hyperfiddle (45)
- # lsp (40)
- # malli (1)
- # missionary (1)
- # nbb (18)
- # podcasts-discuss (1)
- # reagent (8)
- # reitit (2)
- # releases (2)
- # ring-swagger (1)
- # scittle (78)
- # shadow-cljs (96)
- # vim (7)
- # xtdb (3)
We are having an Electric Clojure Zoom session onboarding. We answer questions and help you solve issues. Anyone feel free to attend. DM me.
why is Pending an exception? is it just due to convenience of using try/catch for that? having to wait for a call isn’t really exceptional or an error
Its probably best to think of Electric as its own language, the idioms are different than Clojure
Another example - in Clojure dynamic scope has a bunch of problems - it interacts badly with clojure's lazy collections, and also from a JVM concurrency perspective, bindings are threadlocals which have terrible operational semantics [Leo says: The reason why dynamic vars have terrible operational semantics and bad performance is the binding conveyance mechanism; there is nothing wrong with threadlocal which has well defined operational semantics and are also fast]
but in Electric, dynamic scope doesn't have any of those problems, reactive bindings are a foundational compiler primitive and something we use extensively
another way to think about it - in electric everything has to have an initial value. What's the initial value of a server block that didn't come yet?
coming back to my Pending loading indicator problem from yesterday, why is e/wrap
needed for blocking JVM calls? results seem to work without it
blocking calls will block the event loop
in a multi-user scenario all events will be blocked
in our datascript demo we cheated and omit the e/wrap, we should fix it
but now that makes sense why the loading indicator didn’t work when I wasn’t using wrap
@U09FL65DK do they all have threads?
or i can publish a new version
one thing I liked about Phoenix LiveView (well many BEAM based systems) is the cheap processes and every connection having its own isolated process loop
You're right, BEAM has an advantage here. Loom will make this advantage smaller, but the JVM is still built for throughput
Either way electric needs to run async, so all blocking calls should be wrapped in e/wrap
I could imagine wrap calls to be needed very often, perhaps a e/server-wrap
convenience (kind of like async has go-loop
)
yeah, could be. Maybe the Electric compiler can do stuff automatically, idk
if you would always just wrap
everything, would that cause problems? too much pendings even when you don’t need them
one issue with wrapping everything is that calls like inc
and println
are indistinguishable from query-database
, they are all synchronous and blocking
so the cost of moving inc
to a threadpool is paying thread communication overhead which dwarfs the cost of the actual inc
one idea is to use statistical heuristics, the "Electric VM" can could maybe detect slow calls
could you do something like that in electric, like bind a call
fn that takes a server side function as parameter to call it, wraps it handles errors and logging… even catches exception and shows “error topbar” on client
can you give me a concrete example of that in the context of one of our demos, say the todo list demo?
Ok I understand now - you just want a easy way to log queries, intercept errors, and route errors to a banner
i think you could code that today in userland in a few LOC with a higher order electric fn, or a macro
I made a system I can call like (call. :some-service-name {:foo 42 :bar 123})
and it will invoke a service multimethod on the server in a wrap, and catch any errors… error is shown on client in an alert
Deployment is coming, we have our demos running on fly .io $6/mo tier and performance is great so far, we tested Philadelphia <> Paris, will release the build scripts next week Rapid scrolling over node_modules from Philly to Paris with great performance for $6, it is a sight to behold