Fork me on GitHub
#hoplon
<
2016-07-02
>
jumblerg15:07:07

just got bitten by the implicit refer all in the page macro again. while importing some code from another project, i failed to account for the free variable p below.

(elem :w (r 1 1) :h 66 :p p :c white)
this took a few mins longer than it would normally take me to figure out, however, since p was being bound to the paragraph fn and consequently throwing off the error message:
ui.cljs:105Uncaught Error: Error validating attribute of type length with value function (var_args){
var rest__9347_SHARP_ = null;
if (arguments.length > 0) {
var G__9351__i = 0, G__9351__a = new Array(arguments.length -  0);
while (G__9351__i < G__9351__a.length) {G__9351__a[G__9351__i] = arguments[G__9351__i + 0]; ++G__9351__i;}
  rest__9347_SHARP_ = new cljs.core.IndexedSeq(G__9351__a,0);
} 
return G__9350__delegate.call(this,rest__9347_SHARP_);}.

mynomoto16:07:11

@jumblerg: to avoid that I do most of work on .cljs files, only using .hl for pages that only calls other namespaces doing as little as possible.

mynomoto16:07:40

I even like to use h/p, instead of refering things.

jumblerg16:07:14

but we shouldn’t have implicit magical things going on in the first place

jumblerg16:07:26

kinda like going with use instead of refer

mynomoto16:07:46

Easier to start, bites you later, it's a tradeoff.

jumblerg16:07:00

yeah, classic easy vs simple scenario

micha16:07:31

nah, it's like 5 minutes work to make a task that implements your own page thing, transforms it into a hoplon page decl

micha16:07:42

as a workaround

mynomoto16:07:49

But I sure took advantage of that when starting.

jumblerg16:07:44

@micha: agreed, i’m just advocating an change to the page abstraction.

jumblerg16:07:12

i’m not exactly sure what that change should be yet, i haven’t dug into the implementation, just making the general case for it.

micha16:07:16

(:refer-hoplon :exclude :all) could be added

jumblerg16:07:31

is that supported now?

micha16:07:39

i don't know actually

jumblerg16:07:03

heh. i’ll find out.

jumblerg16:07:56

nope. made the compiler angry.

jumblerg16:07:36

i think maybe it should go the other way, though… page should take a :`refer :all` sort of thing.

jumblerg16:07:45

if you want the current behavior

jumblerg16:07:21

:refer [div p video ...]

micha16:07:19

i think the solution is to make a new page macro

micha16:07:27

so we don't break existing things

micha16:07:42

this can be implemented first as a boot task

micha16:07:00

or as a macro that is shimmed into clojure.core

micha16:07:46

i'll make some experiments

jumblerg16:07:54

k, yeah, i’ll look into it at same point.

jumblerg16:07:57

or you could lol

jumblerg16:07:53

happy fourth of july weekend

micha16:07:15

oh hey yeah

micha16:07:21

likewise!

jumblerg16:07:19

(artifact "index.html"
  (:require
    [hoplon.core :refer :all]))

jumblerg16:07:23

the ns macro wrapped with some extra sugar, basically

jumblerg16:07:14

there’s also a bug i recall ignoring some time ago that pops up when there are multiple pages in the same project

micha16:07:35

what was the bug?

jumblerg16:07:21

i’m trying to recall specifically, but it had something to do with one page loading in, then the wrong page loading in place of the original, maybe when reload was called, it could actually be an issue with that defaulting to index.html or something, not sure.

jumblerg16:07:48

not the best of bug reports

jumblerg16:07:20

but i know it was lurking out there somewhere, keep an eye out for it

jumblerg16:07:33

you can likely reproduce it by putting two different .hl files and their corresponding page macros with different *.html compilation targets in the same project.