Fork me on GitHub
#hoplon
<
2016-06-07
>
dm308:06:49

@yogthos: nice post on Hoplon + Lein 🙂 no one here actually paid attention to that. It does matter for wider adoption, even though Boot is awesome

yogthos12:06:28

hi guys 🙂

leontalbot12:06:05

@yogthos: hi, great article! Thanks @dm3 for mentionning it!

dm312:06:31

I think another huge step to marketing Hoplon would be a release of 6.0.0 🙂

leontalbot13:06:52

Is the use of jQuery is repellent for most reagent folks?

leontalbot13:06:25

I haven't read this in your discussion but heard that here and there

dm313:06:42

given the way people evaluate JS frameworks nowadays - a framework has to meet three criterias: 1) be based on React.js 2) not include jQuery 3) be released during previous 6 months

micha13:06:17

hahaha we fail 3 times

micha13:06:46

i think we can separate the jQuery usage into a separate namespace before 6.0.0, how does that sound?

micha13:06:23

it would mean only adding (:require [hoplon.jquery]) in the ns/page declaration

micha13:06:04

jQuery really only is used by do! and on! multimethods, whose definitions would stay in hoplon.core

micha13:06:43

so you wouldn't need to refer directly to anything in the new namespace, it would only install multimethod dispatches for the core do! and on! multis

leontalbot13:06:46

@dm3 hahaha @micha interesting :-)

leontalbot13:06:36

So defelem doesn't use jQuery?

micha13:06:52

nope, none of the core stuff does, i don't think

micha13:06:32

the core does very simple things, like appending things to the dom, removing them, etc

micha13:06:11

the tricky part is dealing with manipulations and measuring things, etc

micha13:06:35

but that's all in the custom attributes, the do! and on! methods

micha13:06:54

like (div :scroll-to some-cell ...)

micha13:06:14

but you could implement that attribute using goog or zepto or whatever

micha13:06:50

and put that in a different namespace, so then you'd do (:require [hoplon.zepto]) and you'd get the same attributes, just implemented using zepto instead

leontalbot13:06:22

Tempting... Is the separation worth it?

leontalbot13:06:47

Hoplon.jquery hoplon.zepto ...

micha13:06:02

yeah i dunno

micha13:06:10

i'm fine with jQuery myself

micha13:06:46

but like there was a case in here the other day where hoplon was going to be mounted in an application that already had a different version of jquery in use

micha13:06:23

maybe there is a simple solution that i didn't see

thedavidmeister13:06:32

@yogthos: i really don’t know enough about react and reagent

leontalbot13:06:38

Ah yeah... I remember that

thedavidmeister13:06:55

@micha can’t you just do noconflict?

thedavidmeister13:06:04

@yogthos: also, can’t you batch updates to javelin with j/dosync?

micha13:06:49

@thedavidmeister: i thought that would work, but then i thought of jQuery plugins, and how that would work with noconflict?

micha13:06:22

i didn't see how you'd use jQuery plugins with noconflict set, because you'd have two separate jQuerys

micha13:06:29

with their own separate plugins

thedavidmeister13:06:09

@micha oh man, i do it all the time

thedavidmeister13:06:24

i’ve got a project with like, 3 versions of jquery and another one for the “backend"

micha13:06:53

oh i don't judge, our c# app at work has 2 jqeries

micha13:06:26

one of them is to support this old ajax plugin 🙂

thedavidmeister13:06:31

you do end up with separate jquery’s with their own plugins

thedavidmeister13:06:41

can’t be much done about that

thedavidmeister13:06:01

but they work fine in parallel

thedavidmeister13:06:06

you just put them on different globals

thedavidmeister13:06:23

and often i end up hacking the plugin file a little bit to wrap it in a closure

thedavidmeister13:06:31

(can’t spell the word closure any more…)

micha13:06:43

autocorrect clojure

thedavidmeister13:06:56

different plugins have their own way of working with jQuery

thedavidmeister13:06:14

the worst is when they’re like window.jQuery something, something

micha13:06:24

plugins will look for whatever is window.jQuery to attach themselves, no?

thedavidmeister13:06:48

aaaah i had a blog post years ago where i went through all the different ways plugins attach themselves

thedavidmeister13:06:00

and how to mess up the plugin file to make it work

micha13:06:11

ah that's an interesting approach

micha13:06:15

like a shim

micha13:06:28

perhaps could be done automatically?

thedavidmeister13:06:36

nah you can’t do it automatically

thedavidmeister13:06:41

because they all work a little different

thedavidmeister13:06:58

you kind of have to read the plugin and see what it’s doing

thedavidmeister13:06:13

some of them do some weird stuff…

thedavidmeister13:06:30

that said, there was a drupal module i used years ago that tried to do this

thedavidmeister13:06:33

and had a pretty good hit rate

thedavidmeister13:06:05

(function(jQuery) {
  // plugin goes here.
})(jqXYZ);

thedavidmeister13:06:17

that works usually

thedavidmeister13:06:37

lol, i’m getting flashbacks just reading through this stuff

micha13:06:59

haha yess

lewix13:06:06

hoplon is kind of like vue.js

micha13:06:03

javelin has advantages though, given by the value equality that's possible in cljs

micha13:06:12

that isn't really possible in plain js

lewix13:06:04

to my understanding vue.js keep a reference to nodes for data binding

micha13:06:22

comparing pointers isn't as useful as comparing values though

micha13:06:52

javelin formulas don't need to be pure functions, which is really useful and necessary

micha13:06:13

but that's facilitated by the fact that javelin can internally compare values for equality

micha13:06:25

so it can propagate changes only when values change

lewix13:06:36

I'm not following the pointers vs values thingie

thedavidmeister13:06:37

i really like using javelin formulas that trigger things

micha13:06:43

that's what makes it useful to have side effects in formulas

thedavidmeister13:06:44

i dunno if i’m killing kittens when i do that

micha13:06:13

like how do you test if two objects are equal in javascript?

micha13:06:20

like in cljs you can do:

micha13:06:28

(= {:a 1} {:a 1})

thedavidmeister13:06:29

two objects aren’t equal in javascript

micha13:06:47

{a: 1} == {a: 1}

micha13:06:08

well for reactive thingy purposes you'd like the above to return true

micha13:06:31

that's a crucial thing that makes javelin useful

thedavidmeister13:06:52

javascript equality is the worst thing...

micha13:06:08

cljs has immutable, persistent collections, so value equality is cheap, constant time operation

micha13:06:15

via hash codes

micha13:06:46

and with that formulas can now be used with side effects, like thedavidmeister says

lewix13:06:51

it's been a long time coming but I think I'm sold on hoplon

micha13:06:58

because you know the side effect will only happen when it needs to

thedavidmeister13:06:04

so, something i’m doing right now

thedavidmeister13:06:32

is, “when the websocket is connected, and you have an auth token for the current user, and the user selected a project, get all the stuff for that project from the server"

thedavidmeister13:06:03

(cell= (if (and websocket? token current-project) (fetch-stuff! current-project token)))

thedavidmeister13:06:30

oh, i missed an if 😛

thedavidmeister13:06:29

something like that

thedavidmeister13:06:39

it will “just happen” when everything in the if is true

thedavidmeister13:06:57

when the user changes the current project

thedavidmeister14:06:03

it will also fetch those things too

micha14:06:35

yep, you can also make a formula that just contains (cell= (and websocket? token current-project))

micha14:06:53

and then do (add-watch ...) to make the side effect

micha14:06:01

it would be the same effect in that case

micha14:06:08

if you feel bad about the kittens

thedavidmeister14:06:16

i don’t even know about the kittens

thedavidmeister14:06:43

@micha this is kind of off topic, but do you know anything about JWT authentication with sente and ring middleware?

yogthos14:06:51

@thedavidmeister: yeah I think dosync batches like the clj core one right?

thedavidmeister14:06:01

@yogthos: yeah, you dosync and none of the javelin cells update until they all do, and then the new values propagate together

alandipert16:06:11

@yogthos: loved the post also. I'm currently iPad-bound and was able to get my Hoplon dose through it 😀

yogthos16:06:31

excellent 🙂

yogthos16:06:55

and yeah I definitely wish I gave Hoplon a deeper looks earlier

lewix17:06:23

yogthos: should we build something with hoplon at the meetup 🙂

yogthos17:06:40

yeah not a bad idea

yogthos17:06:52

I’m going to present on it at the next one

lewix17:06:11

next week?

yogthos17:06:23

I think so?

yogthos17:06:29

they always sneak up on me 🙂

lewix17:06:30

cool, cause i wont make it tonight

alandipert17:06:44

Where are you guys located?

yogthos17:06:50

wait there’s one tonight

yogthos17:06:53

and Toronto

lewix17:06:13

yogthos: do it next week 🙂

yogthos17:06:41

yeah I don’t think there’s one tonight

lewix17:06:45

alandipert: you?

alandipert17:06:58

Durham NC, USA

yogthos17:06:08

@alandipert: you actually gave a remote talk at our meetup a while back 🙂

alandipert17:06:13

Formerly buffalo tho, visited Toronto often. Love the city

alandipert17:06:37

Yup ! Thanks to Dann, awesome guy

yogthos17:06:51

yeah Dann’s great

lewix17:06:52

micha: why don't you guys combine the virtual DOM and javelin

micha17:06:10

hm maybe that's not what i thought it was

micha17:06:27

there we go

micha17:06:08

hm nevermind, i can't find it now

alandipert17:06:01

I prefer native Dom, has better perf :hugging_face:

alandipert17:06:45

In truth having easy jq plugin access is what I've enjoyed about hlisp way

alandipert17:06:39

I can see that changing as react grows, maybe

alandipert17:06:55

Although it's hard to imagine a force greater than jq

alandipert17:06:47

Then there are things just easier to do in Hoplon, like drag/drop... Since the objects moving are the same ones in the code

alandipert17:06:13

Other things easier to do in react perhaps, like dense/deep trees

alandipert17:06:42

Like a text editor buffer would be an obvious thing to use react for, as emacs does

lewix17:06:20

vue was using native Dom, now they're combining both the virtual DOM and the reactive dependency ; it adds to it in term of performance, it doesn't remove anything as far as I know

lewix17:06:48

alandipert: why is it easier in react?

lewix17:06:49

alandipert: http://gaearon.github.io/react-dnd/ this library is awesome to do drag and drop in react. no surprises

alandipert17:06:06

Well, maybe it is. React can be faster when you don't care about exactly-once change

alandipert17:06:40

Like it's ok for emacs to reprint the buffer as much as it wants, no missiles visibly launching, no other effects attached to the buffer

alandipert17:06:05

So it doesn't need to do equality checks so is faster

lewix17:06:04

a virtual dom does not have to be dependent on React

alandipert17:06:54

I can see it being a thing in the browser, like canvas

alandipert17:06:12

I'll check out that dnd lib

alandipert17:06:47

Altho my point was that because objects real in Hoplon you can do it in so little code, you somos wouldn't care to use/make a library

alandipert17:06:11

Just seems like a sweet spot of the model, other spots like trees maybe less sweet

alandipert17:06:39

Baby is awake back in 18 years

lewix17:06:53

lol @ 18 years

alandipert17:06:19

@yogthos: I forgot to mention, you may consider using for-tpl instead. It's new, less likely to scare people away as loop-tpl has over the years

alandipert17:06:10

Eg (for-tpl [x xs] ... )

yogthos17:06:51

Ah noted, that looks more familiar :-) I'll update the post

alandipert17:06:04

Still both better names than the original, thing-looper lol

yogthos17:06:03

I think it’s mostly the :bindings part that might throw people off

leontalbot19:06:43

Haha lockdown means holding cell ;-)

leontalbot19:06:45

Maybe he hasn't really left hoplon...

micha19:06:22

the prison motif

chromalchemy20:06:12

@jumblerg: Does anyone have any guidance of how to use Hoplon/UI even in it's preliminary state? I followed the responsive-attributes branch checkout procedure here http://hoplon.discoursehosting.net/t/installing-responsive-layout-attributes-hoplon-ui/580

chromalchemy20:06:22

It sets up '[hoplon/hoplon "6.0.0-alpha13"]', but in the Hoplon/UI library code is already update to use 6.0.0-alpha15. Is that branch deprecated for Hoplon UI?

jumblerg20:06:22

@chromalchemy: howdy! …and those are quite out of date.

jumblerg20:06:43

the stuff i’m using in production now is on the v2 branch, i’m about to merge it in this evening or tomorrow

jumblerg20:06:47

some docs should follow

chromalchemy20:06:28

@jumblerg: Hi. I am a big fan of what Hoplon provides, and what you are doing. I've been waiting to ditch CSS forever, and start getting creative!

micha20:06:00

@jumblerg: we can deploy that branch to like 6.0.0-alpha15-reactive-attrs if you want?

jumblerg20:06:33

if you’d like to give it a whirl, despite the fact my readme is just a big warning, check out the current hoplon master and then v2

jumblerg20:06:07

@micha: ty, but that branch isn’t used anymore by ui

chromalchemy20:06:12

Never really learned jQuery well either, and have been holding out for higher level tooling to do the designey web... 🙂

chromalchemy20:06:50

I checked out v2, just not sure how to use it. I don't use the Clojars address in the readme, correct?

chromalchemy20:06:32

Yeah, I'm game to experiment and deal w breaking changes, etc. Maybe i can give some meaninful feedback as a designer.

jumblerg20:06:46

@chromalchemy: it is a bit limited atm, but the layouts seem to be working well. examples of how to use it appear in the material.cljs.hl file in the tst directory

jumblerg20:06:27

that would be great. the idea is to create a number of toolkits as separate libs on top of it; i’m currently working on implementing parts of the material-ui spec.

jumblerg20:06:47

i’m happy to share more snippets of code that uses it from some of my projects in a private channel

chromalchemy20:06:59

@jumblerg: Cool. I am into having a composable foundation so one can build up an intuitive functional design dsl as needed

jumblerg20:06:29

it helps a lot. having tools for abstraction and composition at the ui/design level makes things so much easier.

chromalchemy20:06:12

Thanks. I have to run in a few, maybe I can query you a bit tomorrow. Do you have any links to code examples?

chromalchemy20:06:56

I think it's interesting that the Gui/UI seems to be the most intutive thing to want to program, yet the most convoluted from a software stack perspective.

jumblerg20:06:58

the current challenge is figuring out what the best practices, abstractions are once the there’s actually a way to abstract and compose things

chromalchemy20:06:20

So I dont need the responsive-layouts branch? Why do I need to to check out the current hoplon master? Would I just depend on it in clojars?

chromalchemy20:06:07

I think I might have some ideas on meaninful abstractions that I want to work out and play with.

jumblerg20:06:13

not any longer, not for the v2 branch, i’ve changed a lot and haven’t updated the docs

jumblerg20:06:27

i’d love to hear them

jumblerg20:06:34

it would be awesome to have a designer on board

chromalchemy20:06:51

So I can just build the jar for v2 and use it in a current Hoplon template?

chromalchemy20:06:16

How specifically would I depend on the library in the build.boot and page ns?

jumblerg20:06:42

yes, against the current hoplon master, which is ahead of the last distribution on clojars

jumblerg20:06:13

i’ll try to straighten some of this out in the next 24 hours or so to make things easier for you, maybe even get a build out

chromalchemy20:06:49

Ok. Do I need any special incantation beyond git checkout to use the latest master locally (or does Maven automagically know what to do)?

jumblerg20:06:02

boot has you covered

jumblerg20:06:25

boot build in the ui project

chromalchemy20:06:39

That builds the jar. But then I use that jar in a vanilla Hoplon project?

chromalchemy20:06:09

What would I put in dependencies?

jumblerg20:06:44

no, just use the hoplon/ui jar, hoplon is a transitive dependency

chromalchemy20:06:56

So I use hoplon/ui from that project. I dont need to start another?

chromalchemy20:06:19

So far in my efforts, I am getting errors like this 'WARNING: Bad method signature in protocol implementation, hoplon.core/IHoplonParent does not declare method called -append-child! at line 51 C:\Users\rigalo\.boot\cache\ tmp\Users\rigalo\Desktop\Dev\hoplon\ui\ui-test\1nk\a5dt8o\index.html.out\hoplon\ui\elems.cljs'

chromalchemy20:06:32

Maybe just from not using the latest master yet...

jumblerg20:06:45

yes, that’s why you need the master

chromalchemy20:06:29

So once I build the jar, I can just require '[hoplon.ui]' in a page macro? I dont see it listed in dependencies in the project build.boot.

jumblerg20:06:45

once you run boot build, which will install the jar in your local maven repo, you can add the [hoplon/ui “0.0.1-SNAPSHOT”] to the deps in your boot env map in the build.boot file of your own project.

jumblerg20:06:37

or (checkout :dependencies '[[hoplon/ui "0.0.1-SNAPSHOT"]]) in your development task pipeline if you’ll be hacking it yourself

jumblerg20:06:24

in your src directory just add an app.cljs.hl following the example in the previous link

jumblerg20:06:55

boot develop should get you started

chromalchemy20:06:49

Ok thank you for the directions and boilerplate. I'll try it out tonight and write back.

jumblerg20:06:41

sounds good - i’ll be here a few more hours if any qs arise.