From abd55dc42531f25f100fe8d7c362cd992a4875b1 Mon Sep 17 00:00:00 2001 From: Dustin Getz Date: Fri, 23 Aug 2024 08:51:01 -0400 Subject: [PATCH] Revert "[lang] Uppercase call convention POC" and "fix tests" --- src/hyperfiddle/electric/impl/lang_de2.clj | 13 +++---------- test/hyperfiddle/electric_de_test.cljc | 22 ++++++---------------- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/hyperfiddle/electric/impl/lang_de2.clj b/src/hyperfiddle/electric/impl/lang_de2.clj index 7a2df4370..1800a60e3 100644 --- a/src/hyperfiddle/electric/impl/lang_de2.clj +++ b/src/hyperfiddle/electric/impl/lang_de2.clj @@ -111,20 +111,13 @@ (let [ns (-> env :ns :name), {:keys [line column]} (meta o)] (str ns ":" line ":" column " " o))) -(defn electric-sym? [sym] - (let [s (name sym)] - (and (pos? (.length s)) - (Character/isUpperCase (.charAt s 0))))) - (defn ?expand-macro [o env caller] (if (symbol? (first o)) (let [o2 (?meta o (expand-macro env o))] (if (identical? o o2) - (if (electric-sym? (first o)) - (recur (?meta o (cons `e/$ o)) env caller) - (?meta o (cond->> (?meta o (list* (first o) (mapv (fn-> caller env) (rest o)))) - (and (::trace env) (some-> (qualify-sym (first o) env) (traceable))) - (list `r/tracing (list 'quote (trace-crumb o env)))))) + (?meta o (cond->> (?meta o (list* (first o) (mapv (fn-> caller env) (rest o)))) + (and (::trace env) (some-> (qualify-sym (first o) env) (traceable))) + (list `r/tracing (list 'quote (trace-crumb o env))))) (caller o2 env))) (?meta o (list* (caller (first o) env) (mapv (fn-> caller env) (next o)))))) diff --git a/test/hyperfiddle/electric_de_test.cljc b/test/hyperfiddle/electric_de_test.cljc index ff25b72eb..5c2a92575 100644 --- a/test/hyperfiddle/electric_de_test.cljc +++ b/test/hyperfiddle/electric_de_test.cljc @@ -396,18 +396,18 @@ #?(:clj (tests "reactive doto" - (defn mutable-map [] (new java.util.HashMap)) - (defn put-map [!m k v] (.put !m k v)) - (defn a-ref [] (new Object)) + (defn MutableMap [] (new java.util.HashMap)) + (defn PutMap [!m k v] (.put !m k v)) + (defn Ref [] (new Object)) (def !z (atom 0)) (def !xx (atom 0)) (with ((l/single {} #_(doto (element "input") (set-attribute! "type" "text") (set-attribute! "value" x)) - (tap (doto (mutable-map) ; the doto is incrementalized - (put-map "a" (swap! !z inc)) ; detect effect - (put-map "b" (tap (e/watch !xx)))))) tap tap) + (tap (doto (MutableMap) ; the doto is incrementalized + (PutMap "a" (swap! !z inc)) ; detect effect + (PutMap "b" (tap (e/watch !xx)))))) tap tap) % := 0, % := {"a" 1 "b" 0} (swap! !xx inc) % := 1))) ; mutable map is clojure.core/=, therefore skipped @@ -2263,13 +2263,3 @@ (l/single {} (loop [^java.util.Date x (java.util.Date.)] (.foo x))) :ok := :ok ) - -(e/defn CallMe ([] 0) ([n] n)) - -(tests "electric symbolic calling convention" - (with ((l/single {} (tap (CallMe))) tap tap) - % := 0)) - -(tests "electric symbolic calling convention" - (with ((l/single {} (tap (CallMe 10))) tap tap) - % := 10))