remove makro prove of concept
This commit is contained in:
parent
4aff05e645
commit
6c6b46e72e
3 changed files with 0 additions and 49 deletions
|
|
@ -20,8 +20,6 @@
|
|||
:depends-on #{:scittle}}
|
||||
:scittle.ajax {:entries [scittle.ajax]
|
||||
:depends-on #{:scittle}}
|
||||
:scittle.makro-plugin {:entries [scittle.makro-plugin]
|
||||
:depends-on #{:scittle}}
|
||||
:scittle.qlkit {:entries [scittle.qlkit]
|
||||
:depends-on #{:scittle}}}
|
||||
:build-hooks [(shadow.cljs.build-report/hook)]
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
(ns scittle.makro-plugin
|
||||
(:require-macros [scittle.makros :refer
|
||||
[add-slash-makro add-c-makro]])
|
||||
(:require
|
||||
[sci.core :as sci]
|
||||
[scittle.core :as scittle]
|
||||
[scittle.makros :as sm]))
|
||||
|
||||
(.log js/console (add-slash-makro 1 2))
|
||||
(.log js/console (add-c-makro 5 6))
|
||||
|
||||
(defn add-low-fn [form env x y]
|
||||
`(str "_ form: " ~(str form) " env: " ~(str env) ~x ~y))
|
||||
(defn ^:macro add-low-sci-makro [form env x y] (add-low-fn form env x y))
|
||||
(defn ^:macro add-slash-sci-makro [_form _env x y] (add-slash-makro x y))
|
||||
(defn ^:macro add-c-sci-makro [form env x y] (sm/add-c-fn form env x y))
|
||||
|
||||
(def rns (sci/create-ns 'scittle.makros nil))
|
||||
|
||||
(def scittle-makros-namespace
|
||||
{'add-low-fn (sci/copy-var add-low-fn rns)
|
||||
'add-low-sci-makro (sci/copy-var add-low-sci-makro rns)
|
||||
'make-string (sci/copy-var sm/make-string rns)
|
||||
'add-slash-sci-makro (sci/copy-var add-slash-sci-makro rns)
|
||||
'add-c-sci-makro (sci/copy-var add-c-sci-makro rns)
|
||||
})
|
||||
|
||||
(scittle/register-plugin!
|
||||
::makro-plugin
|
||||
{:namespaces {'scittle.makros scittle-makros-namespace}})
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
(ns scittle.makros)
|
||||
|
||||
#?(:cljs ;only cljs!!
|
||||
(defn make-string [& vs]
|
||||
(apply str "_cljs!_ " vs)))
|
||||
|
||||
#?(:clj
|
||||
(defmacro add-slash-makro [x y]
|
||||
`(#'make-string "/ form: " ~(str &form) " env: " ~(str (:name (:ns &env))) " params: " ~x ~y)))
|
||||
|
||||
;; needs to be both clj and cljs
|
||||
(defn add-c-fn [form env x y]
|
||||
`(#'make-string "c_form: " ~(str form) " c_env: " ~(str (:name (:ns env))) " parms " ~x ~y))
|
||||
|
||||
#?(:clj
|
||||
(defmacro add-c-makro [x y]
|
||||
(add-c-fn &form &env x y)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue