Fork me on GitHub
#hoplon
<
2016-10-15
>
vigilancetech00:10:31

@micha Did you ever figure out why (ns+ ...) doesn't work in .hl files? As a follow up, is there any implication for just using .cljs instead of .hl files? I currently don't seem to be noticing any difference. Maybe a syntax like (page.. :ns+ ...) might easily be made to work in there (since what? .hl's to want to start with "(page....)")?

vigilancetech01:10:25

call was like this, AFTER setting font size/color/style to be visible (tab-button "SYSTEM HEALTH")

jumblerg01:10:50

try something like:

(defelem tab-button [attrs elems]
  (image :a :mid :b 1 :bc :white :url black-button-red-line 
    attrs elems))

vigilancetech01:10:53

worked like a charm!

jumblerg01:10:09

@vigilancetech: by the way, the page macro was designed for use with .hl files, while the ns+ macro extends ns so you can use a regular .cljs file. i don’t think ns+ was intended for use with a .hl file.

vigilancetech01:10:30

I noticed you seemed to be using 'ns+'. Was that because it had better macro importing characteristics?

vigilancetech01:10:17

Is there any disadvantage to using a .cljs file to using a .hl file?

jumblerg01:10:04

well, you don’t have to configure your tooling to recognize them, for one

vigilancetech01:10:05

so the hoplon compile process is essentially just processing the page constructor? And if you don't use it, you can skip the hoplon boot process all together?

jumblerg01:10:07

the cljs files also allow you to use ns+ with hoplon, which in turn allows macros and functions to be imported generally, which means i don’t have to go back and refactor everything when i move a function definition to a macro or vice versa.

vigilancetech01:10:52

Yes, I definitely want to use ns+. I did a fair bit with macros on elisp and I'd rather not have to curtail that much now.

jumblerg02:10:13

the page macro also implicitly :refers all the html element constructors into your .hl file by default. this is convenient when creating a page, at first, but becomes annoying as your app gets larger. for example, after defining a menu element, you might discover later on, after much frustration, that 'menu` is referring to the hoplon constructor for the html menu element instead of the one you created. ns+ requires that you explicitly import these functions like all the others. this also makes it much friendlier for use with hoplon/ui, since the html primitives aren’t used directly.

vigilancetech02:10:24

I'm kind of surprised there's no warning on a collision like that.

vigilancetech06:10:47

Would there be a reason why I can't set a :mouseover event with a ui image element? I'm getting: 'ui.cljs:66 Uncaught Error: Unhandled attribute with value {:mouseover #object[Function "function (){ return cljs.core.println.call(null,"mouse came in");'

onetom09:10:25

@vigilancetech hoplon/ui elements are not DOM elements but an Elem type with 3 DOM elements: https://github.com/hoplon/ui/blob/master/src/hoplon/ui/elems.cljs#L82-L98

onetom09:10:57

the parameters passed to an Elem are collected into a hash-map of attributes and a vector of children by the very same function (`hoplon.core/parse-args`) what hoplon uses for this purpose, as you can see it here: https://github.com/hoplon/ui/blob/master/src/hoplon/ui.cljs#L498-L500

onetom09:10:33

BUT afterwards these attributes are passed thru a stack of middlewares which both validate and interpret these parameters. the assert-noattrs middleware in this stack is what catches any non-handled attributes and throws that error message u see: https://github.com/hoplon/ui/blob/master/src/hoplon/ui.cljs#L434-L437

onetom09:10:16

in hoplon, the parameters - like :mouseover - to the dom elements are interpreted by the on! multi-method as opposed to hoplon/ui's "Elem middleware stack", that's why you can's just expect any attribute which worked in holpon to work in hoplon/ui. btw, the processing of attributes happen here: https://github.com/hoplon/hoplon/blob/master/src/hoplon/core.cljs#L278

onetom10:10:32

Since we don't have these things documented, I recommend you to read the source code itself. I think the reason for lack of documentation is none of us are very sure how to document and what exactly should be documented. However the source code is so short and quite well written, it's makes writing documentation for it an even bigger challenge, imho...

onetom10:10:01

### Hoplon

wc -l (find ~/github.com/hoplon/hoplon/src -name '*.clj' -o -name '*.cljs')
     319 ~/github.com/hoplon/hoplon/src/hoplon/core.clj
     639 ~/github.com/hoplon/hoplon/src/hoplon/core.cljs
      46 ~/github.com/hoplon/hoplon/src/hoplon/storage_atom.cljs
      90 ~/github.com/hoplon/hoplon/src/hoplon/svg.cljs
      43 ~/github.com/hoplon/hoplon/src/hoplon/test.cljs
    1137 total
### boot-hoplon task
wc -l (find ~/github.com/hoplon/boot-hoplon/src -name '*.clj' -o -name '*.cljs')
     147 ~/github.com/hoplon/boot-hoplon/src/hoplon/boot_hoplon/compiler.clj
      52 ~/github.com/hoplon/boot-hoplon/src/hoplon/boot_hoplon/impl.clj
      38 ~/github.com/hoplon/boot-hoplon/src/hoplon/boot_hoplon/kahn.clj
     177 ~/github.com/hoplon/boot-hoplon/src/hoplon/boot_hoplon/refer.clj
     106 ~/github.com/hoplon/boot-hoplon/src/hoplon/boot_hoplon/tagsoup.clj
      18 ~/github.com/hoplon/boot-hoplon/src/hoplon/boot_hoplon/util.clj
     179 ~/github.com/hoplon/boot-hoplon/src/hoplon/boot_hoplon.clj
     717 total
### Hoplon UI
wc -l (find ~/github.com/hoplon/ui/src -name '*.clj' -o -name '*.cljs')
     203 ~/github.com/hoplon/ui/src/hoplon/ui/attrs.cljs
     150 ~/github.com/hoplon/ui/src/hoplon/ui/elems.cljs
     276 ~/github.com/hoplon/ui/src/hoplon/ui/validation.cljs
      29 ~/github.com/hoplon/ui/src/hoplon/ui.clj
     667 ~/github.com/hoplon/ui/src/hoplon/ui.cljs
    1325 total

onetom10:10:35

I hope these metrics are encouraging everyone to peek under the hood for answers. While the response latency is quite good on this channel, just reading the sources might be more efficient. When I say 3000 LoC is short, I mean it's short for what it does. It's not that short when it comes to remembering and understanding all of it, I agree. I myself have read it probably ~4 times in its entirety over the past 2 years and some parts I keep forgetting so I've probably looked those up even 20 times. But since I'm using Cursive, it's super easy to quickly and accurately jump to the definitions...

vigilancetech20:10:15

@onetom although I wholeheartedly agree that RTFM (in this case, the ultimate manual being the sources) is a worthy goal to aspire to, in my case, having read the FAQ where it describes that ultimately 3 <div>s are created by UI elements, plus according to my read of its docu says it should support :mouseover (or possibly what appears to be ":onmouseover"), I am relatively new to clojure(script), the 3000 LoC is pretty rife with advanced, not easily learned features such as prototypes, plus I've had absolutely NO luck so far in getting any "jump to definition" IDE feature running in emacs nor light table (e.g. universal nor exuberant ctags) I'm really struggling to find an answer to what seems to me should be a pretty straight forward question to the right person who IS intimately familiar with the sources (and which I still do not have). Hey, I may be wrong!

jumblerg20:10:28

i often find that i learn the most those times when i’m forced to read through source code, in some cases because i really want to understand the semantics behind a particular function call, or more often than not, due to nonexistent or incomplete documentation. @onetom has a point.

vigilancetech20:10:29

oh, and btw, the ":click" attribute works

jumblerg20:10:55

on the other hand, there’s definitely a cost associated with deriving the abstractions out from the code yourself, and this can be particularly costly in a dynamically typed language like clojure. sometimes you’ve got to climb ten functions up the stack to figure out what arguments a given function might take, and this can be quite painful.

jumblerg20:10:28

and it is rarely convenient at the time i’m trying to do it, often when i just need to get a thing done.

jumblerg20:10:09

good documentation is definitely on the roadmap for ui

vigilancetech20:10:32

@jumblerg normally I would, and indeed I did try, and I also try to exhaust my other remedies before I bring my questions here. There is nothing I would love more right now than to understand that sources to ui inside and out, but for the moment that's not a luxury I can afford. Its a struggle to use something like UI which I feel is superior to the alternatives (like bootstrap) but less documented and conceptually more abstract, or to bite the bullet and wait for ui to mature then have to basically write a significant part of it all over again.

jumblerg20:10:52

yep, i totally get it.

jumblerg20:10:06

hell, i wrote the thing, and i still have to go looking sometimes. 🙂

vigilancetech20:10:18

And I would love to help with that documentation once I get some of this behind me. I'll go thru the ui sources and document the hell out of them WHILE I learn them!

jumblerg20:10:44

that would be terrific

vigilancetech20:10:52

Hey, I know how that works. I still have code today that I have no IDEA how I managed to dream that up while I was in the "zone"

vigilancetech20:10:54

I'm just on a tight deadline for the next project or two, then hopefully I'll be able to "backfill" a bit and contribute to the ui docs

jumblerg20:10:39

detailed docstrings on the public functions would be really helpful. on the other hand, the api is still evolving a bit, and keeping documentation in sync is a lot of work.

vigilancetech20:10:40

I definitely feel like this little hoplon community is on to something big and feel privileged to hopefully be in on the ground floor pushing it over the top. I've basically waited for something like this to come along when it comes to the jumbled up mess that is web development. I'm doubly lucky that I might have a chance to make a few bucks while I learn/refine it.

jumblerg20:10:41

yep. so are you also using ui for a real thing in spite of my warnings not to?

vigilancetech20:10:55

yes, guilty 😕

vigilancetech20:10:40

but I'm committed to rewriting it to keep up with the API if necessary, rather than rewriting from bootstrap to ui

jumblerg20:10:45

ha! it’s pretty cool that there’s such interest though. i think we’re on to something here.

vigilancetech20:10:06

And I'm trying to factor the hell out of it to isolate those API changes.

jumblerg20:10:11

great, because i’m probably going to break your stuff this evening.

vigilancetech20:10:22

lol, ok. Thanks for the warning

vigilancetech20:10:17

Can you make a branch at this point for "stable" and one for "development"?

vigilancetech20:10:31

(I know, stable is relatively speaking)

jumblerg20:10:36

i’m actually doing some work to generalize the image, video component apis right now to deal with your “cat problem”.

vigilancetech20:10:37

lol, "cat problem," I had to think about that one for a min. Yes, good. I worked around it, but more uniform there would be better

jumblerg20:10:41

and yeah, wrt the hoplon community, i feel the same way. the stuff i’ve done on the ui layer is really just a logical progression on top of the core hoplon abstractions that micha rolled.

vigilancetech20:10:43

Its super important IMO. I can even envision at some point in the future for browsers to natively support something like cljs and for the js programmers having to compile the latter to the former, e.g. for js to be the 2nd class citizen here (like it really should be).

jumblerg20:10:49

i’ll do my best to help out and answer your questions as i’m able. it’s rewarding to see people starting to use ui already, despite the fact it is still under development.

jumblerg20:10:08

i also think this is where lisp really shines.

vigilancetech20:10:43

I'm ramping up quickly. My elisp stuff was done about 20 years ago so my old brain is a little rusty. Been doing mostly law that whole time and its funny how that mode of thinking feels like the antithesis of software development (like mostly being reactionary instead of creative, with a lot of arbitrary rules, with exceptions being the BIGGEST rule of all).

jumblerg20:10:20

in almost every other programming language and environment, when it comes to ui work, they have these “code in front” and “code behind” idoms they have to follow, toggling between declarative sgml and the rest of the source. since lisp is declarative already, we don’t have to do this.

vigilancetech20:10:37

I've always noticed anyway, that it takes a lot of time to make the shift. I have a real hard time doing pleadings and then turning right around and writing code without a cooling off period of a few days

jumblerg20:10:42

definitely looking forward to chatting about the law stuff, as an aside.

jumblerg20:10:41

and yeah, as you may have noticed, i’m in a bit of a start - stop - start rut with ui myself. i can relate; it is incredibly inefficient.

vigilancetech20:10:43

yeah, me too. I've even started working on a multimedia database (in elisp) inspired by my need to keep track of cases, exhibits, etc....

vigilancetech21:10:08

here is an old video of my technology: You'll have to crank up the audio or wear headphones. Sorry about that. Part 1. http://www.youtube.com/watch?v=i8PnZ7m5u1A Part 2. http://www.youtube.com/watch?v=FrZFJ-SkzSQ

vigilancetech21:10:16

I'd love to enhance and webify it some day. It's loosely based on the concept of sets that dynamic rearrange their items based on their juxtaposition of other sets on the screen. It seems to be a pretty natural and intuitive way to do search.

tbrooke22:10:17

@vigilancetech - mention of law lit up my radar - I’m another legal person here fiddling with Hoplon off and on - I was sort of waiting for UI to stabilize a little bit - but if it works maybe I should jump in - You are right shuffling between code and law can be tough - they are somewhat inconsistent states - if that makes any sense

vigilancetech22:10:25

@tbrooke totally makes sense to me. It not only happens to me but another programmer/litigator buddy of mine spontaneously experienced the same thing. Its weird!