Fork me on GitHub
#clojurescript
<
2016-04-18
>
superstructor00:04:52

does ClojureScript 1.8.x support direct linking from Clojure 1.8 when compiling to JavaScript ? Is it enabled by default or is it a compiler option ?

danielcompton01:04:53

Direct linking is a compiler option in general, so I imagine it would be the same for running the CLJS compiler

urbanslug14:04:16

Anyone have a real clojurescript project I can look at?

urbanslug14:04:58

Hopefully using boot and multiple cljs files and clj files and html files etc

martinklepsch14:04:42

@urbanslug: are you trying to figure out how to setup your project?

urbanslug14:04:42

@martinklepsch: No, there’s an existing project that I want to work with certain cljs features such as a repl and reload in the browser

urbanslug14:04:58

However, this requires a main cljs file and a main html file

urbanslug14:04:29

Which I lack I want to see how I would go about in adding this to an existing project that lacks them.

banashark16:04:42

@urbanslug: For boot you could check out these articles: https://github.com/bhauman/lein-figwheel/issues/174 https://adambard.com/blog/i-finally-get-boot/ . I haven’t tried boot yet, but it will depend on whether you want to use figwheel, or the more boot-ish boot-reload. Here’s a sample https://github.com/adzerk-oss/boot-cljs-example (warning: i did not pull and try it, it just looked like a repo for almost exactly what you want).

martinklepsch16:04:30

@urbanslug: I made this template which sets up repl + reloading for you https://github.com/martinklepsch/tenzing — maybe it helps to look at the output of the template as if it's an existing project.

bojan.matic17:04:24

is the figwheel lein template outdated? i noticed it generates project.clj with really old clojurescript version

bojan.matic17:04:38

and it includes core.async like this:

bojan.matic17:04:39

[org.clojure/core.async "0.2.374"
:exclusions [org.clojure/tools.reader]]

bojan.matic17:04:35

why the exclusion of tools.reader?

banashark17:04:55

looks like there was a dependency problem: https://github.com/bhauman/figwheel-template/commit/fa8326ad7cc317c216b194b70833f6d1daf5304f . Unfortunately there isn’t any information along with the commit =/.

banashark17:04:33

looks like it might just be for om

bojan.matic17:04:35

if i remove the exclusions it still works

bojan.matic17:04:44

though i am only mucking around with a hello world type app

bojan.matic17:04:08

yeah, i though its only for om too

bojan.matic17:04:10

i’m using reagent

banashark17:04:32

I think the thing at the end is some kind of lein dependency conditional

bhauman17:04:42

thats not a really old clojurescript version

bojan.matic17:04:08

actually when i ran the template it created it with an 0.x version of cljs

bhauman17:04:08

its still up to date are you running into problems?

bojan.matic17:04:36

i bumped clojure and clojurescript to 1.8 and it seems to work fine

banashark17:04:43

what command did you run to create the project?

bojan.matic17:04:16

let me dig through bash history

bojan.matic17:04:20

hope i can find it

bhauman17:04:21

@bojan.matic: yeah thats wrong, you may have a locally installed figwheel template that is really old

joshmiller17:04:44

@bojan.matic: Chestnut is a figwheel-based template with a reagent option that’s pretty up-to-date https://github.com/plexus/chestnut

bhauman17:04:35

lein new figwheel hello should work just fune

bojan.matic17:04:40

this is the command i ran lein new figwheel maxi-clj -- —reagent

bhauman17:04:11

so look into your maven repository and delete figwheel-template

bhauman17:04:18

and try again

bhauman17:04:27

something is wack

banashark17:04:41

@bhauman: Is that "{{#om?}}” at the end a leiningen reader conditional? I’m having a little difficulty googling for it

bhauman17:04:41

@banashark: that is a lein template conditional tag

bojan.matic17:04:58

i’m sorry, how do i look into maven repository? i’m new to the whole jvm thing

bhauman17:04:07

are you on osx?

bhauman17:04:25

~/.m2/repository

bojan.matic17:04:59

not sure what i should find in there

bojan.matic17:04:09

bojanmatic at Bojans-MacBook-Pro in ~/.m2/repository/lein-figwheel/lein-figwheel
> ls
0.2.3-SNAPSHOT/ 0.5.0-6/        0.5.2/

bhauman17:04:10

delete figwheel-template

bhauman17:04:35

delete ~/.m2/repository/figwheel-template

bojan.matic17:04:50

i don’t have that folder

bojan.matic17:04:13

> ls | grep figw
figwheel/
figwheel-sidecar/
lein-figwheel/

bhauman17:04:22

well something is up... run lein new figwheel hello and show me the project.clj

bojan.matic17:04:38

oh wait, i’m so sorry

bhauman17:04:45

exactly ...

bojan.matic17:04:58

it was generating it with 1.7.228

bojan.matic17:04:12

i guess at first i misread it before changing to 1.8

bojan.matic17:04:11

@bhauman: thanks for the help, and thank you for making figwheel simple_smile

bhauman17:04:26

no worries, its working right?

bojan.matic17:04:57

its working awesome

erichmond18:04:18

How is the boot / cljs experience these days?

erichmond18:04:49

I’m happy to stick with lein, but just curious if boot is worth a look

martinklepsch18:04:56

@erichmond: Using boot for everything, it rules!

martinklepsch18:04:52

@erichmond: if you just want to get a feel try tenzing https://github.com/martinklepsch/tenzing :)

amonks18:04:06

@erichmond my experience: boot is totally rad. making new things that work with boot is definitely easier than making new things that work with lein, but the fact that a lot of libraries/plugins/whatever assume you’re using lein introduces some challenge

bojan.matic18:04:14

is there a reason there is no readline functionality in figwheel repl or is my terminal or something broken? I’m using iterm2 on os x

amonks18:04:04

for example, with cljs in lein, there’s a lot of consensus around figwheel and it’s easy to discover and set up

amonks18:04:33

with boot, boot-reload works too but there are fewer arrows pointing at it

amonks18:04:12

@bojan.matic are you using rlwrap?

amonks18:04:55

then I got nothin 😕

bojan.matic18:04:58

i’m stupid, i thought having rlwrap installed made it magically work, starting the repl with rlwrap lein fighwheel solves it

iwankaramazow19:04:48

I just wrote a library, how do people usually generate an api from the source code (public functions w/comments)?

iwankaramazow19:04:08

@bvulpes: should work for me, thanks!

urbanslug20:04:57

@martinklepsch: Hmmm that uses lein

urbanslug20:04:09

I guess you have another project somewhere in there I could look for.

urbanslug20:04:48

Heh I’m in a weird situation in which I suspect boot is unable to compile/find my cljs files but can’t find my clj files.

amonks20:04:04

@urbanslug tenzing is a lein template for a boot based project

amonks20:04:42

uses lein to bootstrap a boot project

amonks21:04:28

my build.boot uses :source-paths #{"sass" "src/cljs" "src/cljc” “src/clj”}

amonks21:04:37

and then source files are in src/clj/<namespace>/core.clj

amonks21:04:39

or whatever

bojan.matic21:04:58

you can’t use eval in clojurescript?

martinklepsch21:04:20

@amonks: @urbanslug you can even use boot-new to generate the project yet but I've been to lazy to update the readme simple_smile

amonks21:04:10

@bojan.matic you can in bootstrapped clojurescript

bojan.matic21:04:34

is not the figwheel repl bootstrapped?

bojan.matic21:04:45

cljs.user=> (eval '(+ 1 2))
WARNING: Use of undeclared Var cljs.user/eval at line 1 <cljs repl>
#object[TypeError TypeError: Cannot read property 'call' of undefined]

bojan.matic21:04:53

while on the topic, is being self-hosted required for a language to have eval capabilities? how does CPython have eval and exec without being self-hosted?

dnolen21:04:55

@bojan.matic: not necessary to be self-hosted to have eval

bojan.matic21:04:42

@dnolen: so why does only bootstrapped clojurescript have eval?

bojan.matic21:04:56

> ClojureScript can now compile both its analyzer & compiler w/o errors. Can eval non-trivial ClojureScript exprs from within the JS host.

bojan.matic21:04:14

i know i’m lacking in cs background, where can i read more about this stuff?

dnolen21:04:39

@bojan.matic: because it meant writing less code - just re-using the compiler that we already have

dnolen21:04:02

most Lisp books cover interpretation

bojan.matic21:04:01

oh, ok - thanks!

dnolen21:04:54

Structure & Interpretation of Computer Programs, Essentials of Programming Languages, Lisp in Small Pieces, Little Schemer all have toy and less toy interpreters

dnolen21:04:10

for Lisp the jump from interpretation to compilation isn’t a particularly big one

rain_omen22:04:24

Q. for all of you fine CLJS folks: when compiling a ClojureScript app, is it possible to target specific JS compilers to potentially avoid the need to include Google’s Closure lib?

rain_omen22:04:34

Ex. case would be writing a CLJS app on top of Electron or some other compiler-specific app framework.

darwin22:04:36

@rain_omen: gclosure and electron are not mutually exclusive, you can make it work together

rain_omen22:04:08

@darwin: for sure. And I have. simple_smile I’m mostly just wondering if the overhead is necessary.

darwin22:04:45

CLJS runtime is built on top of google closure library, and the compiler generates code for it, IMO there is no chance to easily remove that dependency

darwin22:04:18

for example google closure modules (dependency system) is what cljs uses

rain_omen22:04:08

Ah, yeah. Did not consider that detail.

darwin22:04:47

not sure what do you mean by “overhead”

rain_omen22:04:49

Ultimately not a huge deal. Asking mostly as a curiosity at this point. “overhead” was perhaps too strong of a word choice in my last message there.

rain_omen22:04:55

I think “script size” was more what was floating in my head. Then again, for something that’s a distributed as a “native” app, that wouldn’t be much of an issue either.

darwin22:04:30

sure, people usually don’t bother to use advanced optimization when targeting nodejs and similar

darwin22:04:11

if you made the effort, dead code elimination and namespace flattening done by google closure compiler should give you good results

darwin22:04:23

(under advanced optimizations)

rain_omen22:04:07

:thumbsup: thanks for the tips @darwin

naomarik23:04:58

i'm having an issue with including google analytics tracking script if it is loaded after my clojurescript code. basically it tries to call a.handleEvent(b) where 'a' is an anonymous function in closure's google events.js after completing an ajax request using cljs-ajax's ajax.core/GET. i'm not really able to tell much more from the minified code, and this is only in safari and firefox with advanced compilation. i can fix this by not calling my tracking script async but i'm wondering why this is happening?