Fork me on GitHub
#hoplon
<
2018-07-21
>
vigilancetech08:07:28

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?

vigilancetech08:07:38

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?

jjttjj17:07:00

@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__)

Josh Horwitz17:07:44

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?

jjttjj17:07:14

@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.

jjttjj17:07:05

i haven't tried anything like this though

jjttjj17:07:26

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.

Josh Horwitz17:07:49

No problem! Thank you, I might just write it in Hoplon

jjttjj17:07:05

if you're doing complex custom development stuff that's where you really gain a ton of leverage from cljs

jjttjj17:07:27

cool yeah that's probably what I would end up doing 😁

vigilancetech17:07:55

@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> 

Josh Horwitz17:07:01

Is it best just to work through the docs on the website?

Josh Horwitz17:07:20

I’m newer to Clojure/ClojureScript

vigilancetech17:07:59

@jjttjj ahh, I had javelin renamed as "j"

vigilancetech17:07:51

this is making me think the macro not existing should probably throw an error in macroexpand

jjttjj17:07:56

@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

jjttjj17:07:41

https://github.com/hoplon/demos has some good demos to look at too. some are old but they mostly should still work

jjttjj17:07:23

hoplon is really just a couple really simple rules and then a couple edge cases you have to eventually learn

vigilancetech17:07:49

I'd still like to find that web page that went into detail about exactly how/why the javelin macros expand tho

jjttjj17:07:12

yeah it doesn't ring a bell for me but it sounds interesting

Josh Horwitz17:07:52

Thanks, I’ll start working through it

jjttjj17:07:15

basically you just got html elems as functions ie (div ... <args>)

jjttjj17:07:12

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

jjttjj17:07:25

everything else is interpreted as a child

jjttjj17:07:47

which can basically be a regular value, a cell, or another elemnet