A couple weeks ago I found a really good web page describing exactly how javelin macros expand but I neglected to book mark it, its out of my history and I can't seem to find it anymore. Does anyone know which page I might have been looking at?
Also, I'm in a cljs repl and I try and (javelin) mx a simple defc= and it simply returns the original form, but when I do a defn it expands it. Any idea why?
@vigilancetech the macroexpansion seems to work for me:
user> (macroexpand '(defc= x "hi"))
(def x (javelin.core/cell= "hi"))
user> (macroexpand '(cell= x "hi"))
(let* [c__26127__auto__ (javelin.core/cell= x)] (set! (.-update c__26127__auto__) "hi") c__26127__auto__)
I’m building a website for a non-profit I am a part of, and I was hoping of writing it in Clojure/ClojureScript. The only requirement is that it have a CMS or some other way for someone who is not very technical to update the website. Would this be a good use case for Hoplon?
@joshua.d.horwitz i'm biased towards the use of hoplon as much as possible, but realistically it is still a library aimed at developers. You could maybe do a light weight wrapper in hoplon for something like prismic (https://prismic.io/) that i think gives users a nice content editing platform and provides you an api to access the content.
i haven't tried anything like this though
realistically i think if you're looking for a hands off thing you can install and point users to (like wordpress) i don't think there's a great clojure/clojurescript option for that yet, reluctant as i am to admit it.
No problem! Thank you, I might just write it in Hoplon
if you're doing complex custom development stuff that's where you really gain a ton of leverage from cljs
cool yeah that's probably what I would end up doing 😁
@jjttjj here's what I get
(macroexpand '(defc= x "hi"))
(defc= x "hi")
cljs.user> (macroexpand '(cell= x "hi"))
(cell= x "hi")
cljs.user> (macroexpand '(defn foo [x] (+ x 2)))
(def foo (cljs.core/fn ([x] (+ x 2))))
cljs.user>
Is it best just to work through the docs on the website?
I’m newer to Clojure/ClojureScript
@jjttjj ahh, I had javelin renamed as "j"
nvm
cool
this is making me think the macro not existing should probably throw an error in macroexpand
@joshua.d.horwitz https://github.com/hoplon/hoplon/wiki/Get-Started is probably a good place to start and there's a lot of good stuff in that wiki, though it definitely is sort of in need of some re-organization
https://github.com/hoplon/demos has some good demos to look at too. some are old but they mostly should still work
hoplon is really just a couple really simple rules and then a couple edge cases you have to eventually learn
I'd still like to find that web page that went into detail about exactly how/why the javelin macros expand tho
yeah it doesn't ring a bell for me but it sounds interesting
Thanks, I’ll start working through it
basically you just got html elems as functions ie (div ... <args>)
can be any combination, in any order, either :key "value"
pairs {:key "value"}
maps, which are all merged in the end and used as the element's attributes
everything else is interpreted as a child
which can basically be a regular value, a cell, or another elemnet