Fork me on GitHub
#hyperfiddle
<
2023-08-16
>
braai engineer16:08:19

Hmm, how do I debug this error? I looked around for a client DOM effect inside an e/server but I don't see any.

7 | (def electric-main
   8 |   (hyperfiddle.electric/boot ; Electric macroexpansion - Clojure to signals compiler
---------^----------------------------------------------------------------------
Encountered error when macroexpanding hyperfiddle.electric/boot.
Unable to resolve symbol: hyperfiddle.electric-dom2/new-node
{:file "myproject/core.cljc", :in [hyperfiddle.electric-dom2/new-node]}
ExceptionInfo: Unable to resolve symbol: hyperfiddle.electric-dom2/new-node
	hyperfiddle.electric.impl.compiler/analyze-form (compiler.clj:647)
	hyperfiddle.electric.impl.compiler/analyze-form (compiler.clj:632)
	hyperfiddle.electric.impl.compiler/eval11125/analyze--11131/fn--11136/fn--11137 (compiler.clj:700)
	hyperfiddle.electric.impl.compiler/eval11125/analyze--11131/fn--11136 (compiler.clj:699)
	hyperfiddle.electric.impl.compiler/eval11125/analyze--11131 (compiler.clj:688)
	hyperfiddle.electric/boot (electric.cljc:378)
	hyperfiddle.electric/boot (electric.cljc:373)
	clojure.core/apply (core.clj:671)
	clojure.core/apply (core.clj:662)

braai engineer16:08:13

Solved. I had,

(e/defn SomeView []
  (dom/div ...))

;; lower down:
(e/server (SomeView.)
And was calling it from an e/server block. Fixed with this:
(e/defn SomeView []
  (e/client
    (dom/div ...)))

braai engineer16:08:37

I hope incremental will be able to show which e/fn is the culprit :)

πŸ‘ 2
braai engineer16:08:55

Is there an example of how to use Missionary from Electric? I don't see one here, but may be missing it: https://github.com/hyperfiddle/electric/tree/0a63292a9baa7783c7f647e4cfffeaf5055e9f64/src-docs/user/missionary e.g. how to sleep from Electric with m/sleep.

Dustin Getz17:08:51

search m/sleep it's been discussed

telekid17:08:09

Bit of a shower thought – electric's semantics are more or less exactly what you want out of a polyglot build tool like bazel

πŸ‘ 8
πŸ’‘ 2
telekid17:08:31

(the major gap that I see being that the state of electric's nodes obviously don't persist between process restarts)

telekid17:08:02

otherwise, electric is more or less exactly what I'd want out of a build system

Dustin Getz17:08:22

not familiar with bazel but yes agree, "effect system" structure unifies a huge amount of infrastructure that today is disjoint

Dustin Getz17:08:38

I maintain a list:

Dustin Getz17:08:39

β€’ hot take: the following technologies unify under the umbrella concept of "functional effect system" β—¦ Kubernetes β—¦ Erlang process supervision β—¦ Microsoft Orleans β—¦ Akka β—¦ Rx β—¦ Zio β—¦ Cloud Haskell β—¦ Clojure's Missionary β—¦ Electric Clojure β—¦ Unix, Windows (process/program/task manager) β—¦ Java threads, OS threads β—¦ Frontend rendering with signals

πŸ‘ 6
Dustin Getz17:08:58

β€’ value prop β€” functional effect systems β—¦ cancellation β—¦ concurrency and backpressure combinators β—¦ composability / referential transparency – coordinate large scale effect fabrics β—¦ glitch-free event propagation β—¦ correct error handling by default (process supervision) β—¦ resource lifecycle (RAII) – strong resource cleanup guarantees

πŸ‘ 6
Dustin Getz17:08:08

β€’ List of relevant topics: β—¦ Process supervision (trees) β—¦ Observable sharing (DAGs) β—¦ Graceful termination β—¦ Self-healing software β—¦ Resilience β—¦ Actors β—¦ Signals and event streams / FRP β—¦ functional effects β—¦ concurrency and backpressure

πŸ‘ 6
teodorlu13:08:49

> Bit of a shower thought – electric's semantics are more or less exactly what you want out of a polyglot build tool like bazel > Or the semantics for a "thing to manage your system" like integrant or component. Feels like integrant solves the narrow, parochial version, whereas electric solves the general version. On that sidenote, JVM only Electric could make sense - for cases where one wants the reactivity, but don't want reactive web clients.

πŸ‘ 2
yes 2
Garrett Hopper13:08:11

> JVM only Electric could make sense CLJS only could be useful as well for that matter. Essential allowing Electric reactivity without requiring the websocket connection. (And then disallowing e/server & e/client when there is no connection)

βž• 2
Dustin Getz14:08:32

JVM and JS only i think already works (just don't use e/client e/server) – the e/run unit test entrypoint mocks out the network. However the runtime overhead for network management is still present (may not matter)

πŸ‘€ 2
πŸ‘ 2
Dustin Getz14:08:18

Indeed electric dynamic scope is roughly competitive with Component and other DI frameworks

πŸ‘ 2
Dustin Getz14:08:09

We don't advertise it because we have not done like a requirements analysis to figure out exactly what we have and don't have for a general purpose DI use case like that ... we're super focused on web UI. Using Electric for a different use case likely will have rough edges or some mismatches with how Clojure programmers might be accustomed to structuring your systems, we don't know yet

πŸ‘Œ 2
teodorlu14:08:25

Rightβ€”to get something as nice as Integrant for local development with Electric definitely requires some thinking and some work.