- Direct filesystem reads from the view
- Direct function composition in the style of PHP, despite network
- No API, no client side database, no frontend state at all (except DOM), no frontend/backend.
- Literally all accidental complexity GONE
- 100% of server data sync is managed by Electric
- Rows have arbitrary server local data access, here querying file metadata #clojure
- Optimized and no scroll jank – DOM elements are fixed in place and reused
Electric Clojure lets you code frontend/backend expressions that compose across the client/server boundary, due to compiler-managed network powered by DAGs. #Clojure
20230131.hello.photon.tranasfer.2.edited.mp4
p/defn
defines a function that follows all the same laws as regular Clojure functions, but it’s actually a macro that compiles the function body into a DAG (Directed Acyclic Graph).
Photon is a network-transparent Clojure/Script dialect for full-stack web application development. It uses macros to let you interweave client and server code in a single .CLJC file, so you can define a full-stack frontend/backend webapp all in one place. Photon is designed for stateful full-stack web applications with complex frontend/backend data sync requirements.
Newest demos:
- Datomic web explorer (Oct 2022)
Personal favorites:
(ns dustin.y2021.missionary_promise | |
(:require [hyperfiddle.rcf :as rcf :refer [tests % !]] | |
[missionary.core :as m])) | |
; We want to turn a promise-thing into a Task | |
; Leo: The problem with Promise and CompletableFuture is no cancellation | |
; What task do we want? Is the task listening to the promise? Or is the task the process backing the promise? | |
; Background: when you get a promise, there is a process in the background which eventually completes the promise. | |
; Do you want to await the result of an already running promise | |
; or do you want to run the process of the promise when the task is run? |
We use #user/uri
rather than unquaified #uri
per Alex Miller comment in the Ask Clojure thread.
License: public domain
(defmacro future | |
"Takes a body of expressions and yields a future object that will | |
invoke the body in another thread, and will cache the result and | |
return it on all subsequent calls to deref/@. If the computation has | |
not yet finished, calls to deref/@ will block, unless the variant of | |
deref with timeout is used. See also - realized?." | |
{:added "1.1"} | |
[& body] `(future-call (^{:once true} fn* [] ~@body))) | |
| |
(defn future-call |
This fullstack web app is 239 LOC in a single file, coded with just fns in the straightforward/easy style of PHP. All client/server I/O is managed!
It took him 10 hours. Thank you Malte! #Clojure
20220529.Photon.Datomic.Viewer.-.Malte.Nottmeyer.mp4
- This demo uses DataScript's API for speculative transactions, not sure if can be done with sql read transactions.
- DataScript is on the server; code is network-transparent.
- 100 LOC for everything (table, query, popover, css, page)