Fork me on GitHub
#boot
<
2015-12-08
>
onetom00:12:39

@micha: this what might happen if u forget to pay your internet bill in hong kong:

[email protected] ~/g/b/boot> make install
(cd boot/base && mvn -q install)
[ERROR] COMPILATION ERROR :
[ERROR] error reading /Users/onetom/.m2/repository/org/projectodd/shimdandy/shimdandy-api/1.2.0/shimdandy-api-1.2.0.jar; error in opening zip file
[ERROR] error reading /Users/onetom/.m2/repository/org/projectodd/shimdandy/shimdandy-api/1.2.0/shimdandy-api-1.2.0.jar; error in opening zip file
[ERROR] /Users/onetom/github.com/boot-clj/boot/boot/base/src/main/java/boot/App.java:[24,32] package org.projectodd.shimdandy does not exist
[ERROR] /Users/onetom/github.com/boot-clj/boot/boot/base/src/main/java/boot/App.java:[40,20] cannot find symbol

onetom00:12:04

the shimdandy.jar file contained a payment notice html 😉

onetom00:12:09

micha: quick question, why am i getting Unable to resolve symbol: regular-sync in this context when i run boot itc-regular-sync?

(deftask itc-regular-sync []
  (with-pre-wrap
    fileset
    (require '[itunes-connect.regular-sync :refer [regular-sync]])
    (print (resolve (regular-sync)))
    fileset))

onetom00:12:23

(getting off the ferry, check back later)

martinklepsch00:12:13

@onetom: resolve takes a symbol, you probably want sth like ((resolve 'regular-sync))?

onetom01:12:57

martinklepsch: ah, sorry. i was just trying resolve because i was getting that error message i showed. that's the real problem. but checking now what happens otherwise

micha01:12:55

yeah you need to do like this

micha01:12:15

(require 'itunes-connect.regular-sync)
(let [regular-sync (resolve 'itunes-connect.regular-sync/regular-sync)]
  (regular-sync ...)
  ...

micha01:12:52

the reason is that the clojure compiler compiles top level forms sequentially

micha01:12:08

meaning it fully compiles and evaluates each top level form one after the next

micha01:12:17

this is why you can do this at the top level

micha01:12:44

(require '[foo :refer [bar]])
(bar)

micha01:12:55

but if you do this you will get an exception:

micha01:12:31

(defn doit []
  (require '[foo :refer [bar]])
  (bar))

micha01:12:46

it treats the entire defn as a unit

micha01:12:11

it compiles the whole defn, and then evaluates it

micha01:12:34

but in the former case it would compile the require and evaluate that by itself

micha01:12:42

and then compile the call to bar and evaluate that

micha01:12:06

which succeeds because when it goes to compile the call to bar the call to require has already been evaluated

onetom01:12:12

micha: thanks!

andrewboltachev05:12:44

Hi. I have file like this http://dpaste.com/314RJ06 and what I want to do is "development in loop". Each time I save file (somewhere on the project) I want (main) fn to be executed. What I got now (with line 29 both commented out and not) so that it executes main and "speaks" two times each time I save the file. What am I doing wrong?

juhoteperi11:12:13

@danielsz: Transit version is a bit dated, one sec

danielsz11:12:35

@juhoteperi I love the edn version more simple_smile

danielsz11:12:01

I rewrote it for cljc

juhoteperi11:12:40

The performance difference between EDN and Transit is so huge for browser env that Transit is usually better choice

juhoteperi11:12:46

The EDN version should probably use the same read and write functions as Transit version

juhoteperi11:12:59

cljs-time methods used in EDN version are really slow

juhoteperi12:12:26

Yeah, I wonder why I did not use that

martinklepsch12:12:53

RFC3339 = ISO8601?

juhoteperi12:12:07

RFC3339 is one profile of ISO8601

danielsz12:12:24

@juhoteperi I hear you, but I'm working with a 100% Clojure system where all data flows as edn. Using transit just for performance reasons doesn't seem compelling to me in this scenario.

juhoteperi12:12:53

Speaking about dates, what do people think about implementing a date handling library completely on Clojure? It would remove the differences between JVM and Browser envs

danielsz12:12:17

@juhoteperi: Well, that is what you achieved with this gist simple_smile

juhoteperi12:12:01

@danielsz: Yeah if you aren't reading the EDN in browser it's fine

juhoteperi12:12:17

The performance difference is only in browsers

martinklepsch12:12:24

you mean like a joda time in cljc?

juhoteperi12:12:38

@martinklepsch: yes

martinklepsch12:12:54

sounds like a big yak

danielsz12:12:35

@juhoteperi what do you mean with not reading the EDN in browser?

juhoteperi12:12:32

@danielsz: In browser EDN reader is implemented in Cljs/JS but JSON reader is implemented in C or such by the browser so reading JSON is much much faster than reading EDN. And transit is built on top of JSON so it's faster than reading EDN in browser.

danielsz12:12:12

@juhoteperi I know it's faster, but what are we talking about? Milliseconds. Not something I can notice (or the user).

juhoteperi12:12:03

@danielsz: Will be noticeable if the documents start getting larger, maybe tens of milliseconds for something like 200KB document.

micha12:12:33

it's definitely noticeable

micha12:12:40

for the kinds of apps i make

micha12:12:17

the clojure reader is extremely slow

danielsz12:12:25

@juhoteperi I don't think it's the size of the document that is the determining factor, it is the number of date instances in EDN that you read and write.

juhoteperi12:12:55

@danielsz: Nope, even with optimized date readers and writers EDN is slow

juhoteperi12:12:40

@martinklepsch: That's what I fear but currently handling dates is quite hard in shared domain logic code

martinklepsch12:12:39

@juhoteperi: maybe it's easier/more efficient to just wrap jodatime/goog.date in uniform way?

danielsz12:12:00

If you only have a couple of such EDN instances, I think it's perfectly acceptable. Not an optimization priority.

juhoteperi12:12:29

@martinklepsch: Yes, that's what I'm doing currently. Probably I just should finalize and make a library out of this to see how well it really works.

danielsz12:12:24

@martinklepsch: that's what's this gist does. It turns joda dates into edn entities that are read and written in an uniform way via the clj-time and cljs-time libraries (that offer the same API)

danielsz12:12:55

It is exactly what you want to do with dates.

juhoteperi12:12:02

@danielsz: They really don't. Cljs-time formatting is really limited.

martinklepsch12:12:13

Unrelated idea: I'm thinking of making a lambda fn that takes a git repo as argument and returns documentation info (like cljs-info or codox but as edn/transit). From that it would be quite easy to make an app that can provide api docs for any git hosted clojure codebase — thoughts?

danielsz12:12:21

@juhoteperi: You keep saying that simple_smile

danielsz12:12:46

At this point we need benchmarks

juhoteperi12:12:57

@danielsz: Yeah well usually it's not a problem but try rendering a table with 2000 dates and it is noticeable.

danielsz12:12:23

@juhoteperi: That's what I'm saying. I don't have 2000 dates. I have two dates. simple_smile

martinklepsch12:12:54

@juhoteperi: @danielsz the gist only handles serialization ...I understood @juhoteperi as if he wants a thing that also provides uniform APIs to modify/compare/etc dates

juhoteperi12:12:55

Yeah, if/when I will implemented something proper I'll do benchmarks but currently if have just seen that in certain cases if will be a problem.

danielsz12:12:50

@martinklepsch: The beauty of this solution is that you don't need anything. The API is provided by clj-time/cljs-time.

danielsz12:12:01

Which lets you compare, add, etc.

danielsz12:12:50

That's leveraging the power of edn

danielsz12:12:04

Custom reader tags for the win

juhoteperi12:12:31

Yeah and it works the same way with Transit

juhoteperi12:12:59

Perhaps having a cljc-time lib would be one solution for even nicer shared code

juhoteperi12:12:10

That lib would also provide namespaces for EDN and Transit readers and writers one could use in a project without copying the code

danielsz12:12:46

@juhoteperi: Sure. That would be convenient. What I appreciate in this solution is the generality. Once you understand how to leverage EDN in your application code, you can apply that for any non-native type/object. joda time is just one particular case.

micha12:12:50

@andrewboltachev: what is your command line like? how are you running your code there?

danielsz12:12:36

@juhoteperi: @martinklepsch All this reader tags and edn affair in Clojure is in essence a streamlined and somewhat constrained version of Lisp's reader macros.

danielsz12:12:15

@martinklepsch: BTW, I like the idea you mentioned about the lambda fn generating docs from a git repo.

martinklepsch13:12:11

@danielsz: unfortunately there are plenty of html documentation generators but none of them has a simple api for getting this information as data 😕

andrewboltachev14:12:19

@micha: boot db0001

pesterhazy16:12:20

If boot show --pedantic shows a few "conflicts", is that cause for concern?

micha16:12:55

not really

micha16:12:02

pretty much unavoidable

micha16:12:31

you can eliminate them by adding :exclusions to your dependencies

micha16:12:49

but i haven't found that to help much really

micha16:12:32

unless the exclusions are needed, like if aether is not choosing the transitive dependencies you want (i.e. you want to resolve the conflict differently)

micha16:12:54

conflict resolution is of course deterministic

micha16:12:13

so adding extra exclusions annotations probably isn't going to improve anything

pesterhazy16:12:38

makes a ton of sense

pesterhazy16:12:46

I guess it's called --pedantic for a reason

micha16:12:59

it's important to be able to see the conflicting versions, because sometimes you need to tell it to resolve them differently

micha16:12:30

like if you add dependencies and all of a sudden everything is broken with weird exceptions coming from code you've never heard of

micha16:12:40

it's probably because some transitive dep was swapped out

pesterhazy16:12:32

yeah, I've had that happen to me a n few times

pandeiro19:12:55

has anyone used closure modules yet from boot-cljs ?

flyboarder19:12:31

@pandeiro: yes I use the Dom lib from google closure

pandeiro19:12:21

Ah @flyboarder actually I'm talking about modules in the compiler sense, not the Closure library modules

pandeiro19:12:36

I have an app at work that needs to be divided and I'd like to explore creating several JS artifacts with app-specific and shared code, rather than do two whole separate builds

pandeiro19:12:46

I'm not sure if boot-cljs supports this yet

pandeiro19:12:06

I'm guessing that with the *.cljs.edn convention, it doesn't

flyboarder19:12:35

@pandeiro: ah I misunderstood, I don't think at this time it does

flyboarder20:12:14

Which might be why boot has several artifacts and is made with make

flyboarder20:12:01

I took at brief look at building boot with boot but it's a bit beyond me, I'd really like to get it working on clr

micha20:12:09

the .cljs.edn convention is what will make it possible to do automatically in the future

pandeiro20:12:43

Oh yeah @micha ? Have you guys already thought about how to integrate this?

micha20:12:58

given a set of .cljs.edn files, the compiler has enough information to automatically partition your namespaces into modules in an optimal way

micha20:12:08

because the .cljs.edn files contain all the information about which namespaces are needed in which compiled js file

micha20:12:31

and we make a new shim or whatever to load the modules correctly, automatically

pandeiro20:12:33

so what would the API look like in boot-cljs? an additional parameter of some sort...

micha20:12:46

yeah just --use-modules

micha20:12:52

no configuration needed

micha20:12:08

maybe it could be the default for advanced optimizations

pandeiro20:12:34

Is the naming default?

micha20:12:45

that's an implementation detail

micha20:12:51

the user never needs to see it

micha20:12:56

so we gensym the name

micha20:12:14

there is nothing reusable in those modules

micha20:12:26

you can't distribute them or anything

pandeiro20:12:46

right, but you need to have index.html load the e.g. common.js module

pandeiro20:12:55

so you need to know what it's going to be called

micha20:12:56

no, that would be done automatically

micha20:12:07

in the js

pandeiro20:12:17

even in advanced, it would be shimmed in?

micha20:12:18

via document.write()

micha20:12:30

we did it before, it worked fine

micha20:12:03

that's how we originally solved the --unified mode thing

micha20:12:13

before cljs adopted the technique

pandeiro20:12:37

does the use of modules have an impact on compilation times? do you know?

micha20:12:42

you wou'd only use this in advanced mode

pandeiro20:12:49

right, only in advanced, sure

micha20:12:04

it probably takes longer to make the modules

pandeiro20:12:14

yeah I imagined

micha20:12:24

you don't do it very often though

pandeiro20:12:28

but I also imagine the time is significantly less than producing two whole builds

micha20:12:40

you have to produce the whole builds though

pandeiro20:12:52

you still need both cljs.edn files

micha20:12:54

plus the extra work of figuring out the module stuff

micha20:12:12

i bet it takes 50% longer

pandeiro20:12:41

i was thinking it would somehow be a single pass through

micha20:12:04

oh, yeah that might make it faster

pandeiro20:12:35

could two boot-cljs processes be run at the same time in parallel?

pandeiro20:12:42

and would it even make sense to do so?

pandeiro20:12:51

like, to speed up two builds

micha20:12:20

yeah it would be twice as fast

pandeiro20:12:21

i imagine using the new (target ...) task that was added recently

micha20:12:24

if you have enough memory

pandeiro20:12:38

interesting

pandeiro20:12:49

could you build both simultaneously to the same target?

micha20:12:50

yeah you could also use the --target option to point the different boot instances at different target directories

micha20:12:00

no, that would be madness

micha20:12:19

but cp -R ... is your friend there

pandeiro20:12:34

yeah sure, I can bash at that level

micha20:12:57

there is a way to do it all from inside of boot if you really want to

pandeiro20:12:07

I'm gonna try that, though I wonder if the instances we're using to build will have the requisite memory

pandeiro20:12:11

How would that be?

pandeiro20:12:18

like with futures?

micha20:12:27

that's an example

pandeiro20:12:53

that is cool

pandeiro20:12:00

what is with-pass-thru ?

micha20:12:26

it's in master now

micha20:12:35

it's equivalent to this:

micha20:12:55

(with-pre-wrap [fs]
   ... ;; do something
  fs)

micha20:12:06

now you can do this instead:

micha20:12:31

(with-pass-thru [fs]
  ... ;; do something
  )

micha20:12:49

sometimes a task is only for side effects

micha20:12:58

and doesn't touch the fileset

micha20:12:41

that's what with-pass-thru is for

pandeiro20:12:10

ah ok, nice