Fork me on GitHub
#clojurescript
<
2016-03-07
>
bbss03:03:46

@richiardiandrea: I edit my post after to include a different issue, I use the paths and IO function from the readme and can import my own namespaces. But for instance core.async I can't import. Is there any more paths I need to include? I assumed ["/src/cljs" "/js/compiled/out"] would be enough.

bbss03:03:18

@mfikes: core.async not in bootstrapped, that is too bad. Is that on the horizon for support in the future or is that really difficult to get done?

mfikes03:03:21

@bbss I'm pretty sure Cognitect isn't pursuing it, so it is probably up to the community if it is going to happen. I hacked on it a bit a while back. I came away feeling that it is indeed possible to succeed (although the code will have shifted significantly, making it hard to keep in sync with upstream changes). We've also learned a bit about macros in bootstrapped ClojureScript and bootstrap has itself also matured. So, in short core.async isn't there, but could be if someone sat down and put in perhaps a chunk of a week porting it. Here is what I was doing: https://github.com/mfikes/core.async/commits/self-host

bbss03:03:48

Okay, good to know, thanks.

mfikes03:03:10

Most ClojureScript libraries involve only a little porting to get them to work, but then you have things like core.async which is a lot of Clojure macro code.

bbss03:03:01

I see, I am not so familiar with macros yet so this seems a bit daunting to me. Nevertheless could be interesting to dive into the internals a bit.

mfikes03:03:50

@bbss Aspects are still very new to me, frankly, especially when it comes to bootstrap. I mistakenly thought that a consequence of the staged ClojureScript compilation model would be that we would have to build lots of macro “towers,” and I only recently discovered I was incorrect: http://blog.fikesfarm.com/posts/2016-03-04-collapsing-macro-tower.html

bbss04:03:11

@mfikes are there places where I can read more about clojurescripts compilation model? I read some of your posts on the macros but can't say I understand them well, might need to read that book on macros you recommended somewhere. 😅

nidu07:03:17

Hello. Is it ok that uuid's for strings with different case in ClojureScript are different? For example (= (uuid "071C600F-B72B-44AE-8A15-9366EA1BB9D9") (uuid "071c600f-b72b-44ae-8a15-9366ea1bb9d9")) returns false.

nidu07:03:49

It seems spec requires string to be lower-case (according to this post http://stackoverflow.com/questions/8258480/type-of-character-generated-by-uuid) however there are multiple violations. Moreover java returns true for (= (java.util.UUID/fromString "071C600F-B72B-44AE-8A15-9366EA1BB9D9") (java.util.UUID/fromString "071c600f-b72b-44ae-8a15-9366ea1bb9d9")). Maybe that's my point of confusion.

solicode07:03:18

@nidu Yeah, that result is surprising to me. It might be worth reporting.

nidu07:03:47

Moreover it seems every string is accepted to uuid. (= (uuid "123") (uuid "123")) also returns true.

nidu08:03:30

Created issue #CLJS-1599 for it

rnandan27309:03:09

Is modelling the app around -re-frame similar in concept to using relay in javascript

d-side09:03:36

@rnandan273 I've been poking re-frame for the last few days, never seen Relay before. Yeah, concepts sure look similar, GraphQL queries being subs, GraphQL params being reactions... I fail to see the event part though, this seems to be handed off to React itself.

d-side10:03:30

Or, um... no, GraphQL mutations are part of that flow too.

rnandan27310:03:43

@d-side thanks for sharing

d-side10:03:32

Actually seems like Relay has two different concepts of parametrization (e. g. displaying different subsets of available data) and mutation (e. g. changing the available data). Re-frame uses the same mechanism for both since parameters are part of the global state too.

d-side10:03:30

Well, at least according to my limited understanding of both. I'm reading through Relay docs right now. Does feel familiar, but it's the same feeling as reading React docs after reading Reagent docs: makes me wonder does it really have to be that complicated .-.

mfikes13:03:29

@bbss: Even though you read some, here is a list of posts I've written about macros and bootstrap. https://gist.github.com/mfikes/7a3902f7a8260fe6aab2

mfikes13:03:20

Feel free to ask, some of this stuff is a bit puzzling at times, but we can sort through it.

kspear15:03:05

I'm trying to build a cljs web app that will periodically make an ajax call to an api that will return JSON, for purposes of updating status icons on the page. I'm not quite sure what the "best practices" are for this sort of functionality. Can anyone point me in the right direction? Thanks!

chrisoakman15:03:16

@kspear: I don't know about "best practices", but that architecture is exactly how TourneyBot works: https://github.com/oakmac/tourney-bot

chrisoakman15:03:50

on the "client" side, it polls for the entire tournament state (`tournament.json`), and then renders the page with that information

kspear15:03:15

Thanks @chrisoakman, I'll give that a look. Appreciate it :)

lvh15:03:30

Hi! I’m trying to add core.logic queries to my CLJS app; where end-users write queries that compile down to core.logic programs. core.logic seems to be primarily implemented as macros. I’m wondering if it makes any sense to do the compilation for that on the server-side (i.e. in the JVM with the usual Closure optimizations) — I’m guessing there’s a decent chance the resulting code will be faster, since cljs.js doesn’t get the benefits of the Closure compiler?

lvh15:03:09

mfikes: Thanks for the links, reading up now

michaelr15:03:04

i have a cljs library and a small cljs project which i run with figwheel to develop the library. how can i make the library linked with the test project so that i would not have to run lein install after every change in the library?

maio16:03:01

@michaelr: I'm not sure about right solution, but you could add that library into :source-paths in project.clj of that small project (but you will need to also include it's dependencies)

michaelr16:03:45

maio: hey that might work

michaelr16:03:51

@maio: yep worked. thanks!

smogg17:03:41

I’m trying to setup figwheel with SASS using this script: https://github.com/bhauman/lein-figwheel/wiki/SASS-watcher

smogg17:03:05

cljs/sass compilation work fine, but I’m unable to connect to the repl from the browser

smogg17:03:14

is there any additional setup required?

martinklepsch18:03:05

Nice, there seems to be lots of progress on proto-repl lately. Atom is certainly a much more beginner friendly environment than Emacs/Vim. Do you use it yourself @adamkowalski? How do you cope with the broken auto indentation for LISPs? That's like a major roadblock to using it more for me. Liked it a lot besides this actually.

chrisoakman18:03:26

The auto-indent for Atom is a pretty serious problem. I've been meaning to look into it soon.

chrisoakman18:03:43

The language-clojure package needs some love.

martinklepsch18:03:32

@chrisoakman: I looked at it for a bit and toyed around but unfortunately I think it's a pretty fundamental issue with atoms indentation architecture (if you can call it like that)

martinklepsch18:03:52

It uses regexes to indent/de-dent and that doesn't play nice with ((()))

jaydeesimon19:03:58

Hello all. Can anyone tell me why the following doesn't work?

jaydeesimon19:03:05

cljs.user=> (defn hello [] "Hi!")
#'cljs.user/hello
cljs.user=> ((var hello))
"Hi!"
cljs.user=> ((var (symbol "hello")))
clojure.lang.ExceptionInfo: clojure.lang.PersistentList cannot be cast to clojure.lang.Named at line 1 <cljs repl> {:file "<cljs repl>", :line 1, :column 2, :tag :cljs/analysis-error}

smw19:03:45

what do you get when you do (var (symbol “hello”))

jaydeesimon19:03:23

cljs.user=> (var (symbol "hello"))
clojure.lang.ExceptionInfo: clojure.lang.PersistentList cannot be cast to clojure.lang.Named at line 1 <cljs repl> {:file "<cljs repl>", :line 1, :column 1, :tag :cljs/analysis-error}

jaydeesimon19:03:42

i get the classcast exception

jaydeesimon19:03:11

is there a way to get the var if I know the name of the symbol?

smw19:03:58

(sorry, got a call)

jaydeesimon19:03:11

i wasn't sure if my question was clear

smw19:03:24

I don’t know the answer, trying to reason it out.

smw19:03:28

(def foo "hello")
=> #'rgnt.repl/foo
(symbol "foo")
=> foo
(type (symbol "foo"))
=> clojure.lang.Symbol

codonnell19:03:39

@jaydeesimon: How about ns-resolve

codonnell19:03:09

not sure if that works in clojurescript or not

jaydeesimon19:03:32

yeah, looks like that's not available in ClojureScript

dmitrig0119:03:42

at least in clj, find-var?

jaydeesimon19:03:18

so I saw that post and then I read this later from David Nolen's blog http://swannodette.github.io/2014/12/17/whats-in-a-var

jaydeesimon19:03:29

which led me to var

jaydeesimon19:03:14

which led me to try out the thing that I posted but I'm clearly missing something

dnolen19:03:16

@jaydeesimon: there are no real vars nor reified namespaces in ClojureScript

dnolen19:03:31

the var functionality is extremely limited, it exists primarily only to support cljs.test

dnolen19:03:56

you should in general avoid anything to do with vars in ClojureScript - this stuff doesn’t port and it’s never going to

jaydeesimon19:03:22

@dnolen: got it. thanks guys! I'll take a different approach then

dnolen19:03:13

@jaydeesimon: if you’re trying to look up something at runtime your only option is to use ^:export and write your own resolution thing

dnolen19:03:23

runtime resolution is completely at odds with advanced compilation

smw19:03:02

David, do you envision webassembly becoming the host for clojurescript at some point in the future?

dnolen19:03:35

@smw unlikely for the foreseeable future - it doesn’t currently bring anything to the table

dnolen19:03:53

for ClojureScript (for C++, different story)

jasongilman19:03:10

@chrisoakman: I have new lines working fine in Atom. I use lisp-paredit just for that with other options off. I need to make this an explicit part of Proto REPL.

chrisoakman19:03:10

Interesting; I want to take a look at that.

chrisoakman19:03:27

There has been some discussion in the #C0F2A0MJN channel about handling indentation.

chrisoakman19:03:34

Do you have a link to the relevant source for that feature?

smw20:03:27

Thanks David. I figured the gains would probably come in speed as well as, eventually, threading support, etc. First class language without the requirement to compile to js. But maybe the thing I’m thinking about is actually a different language.

chrisoakman20:03:59

@jasongilman: thanks simple_smile I'll give this a look

smw20:03:25

I wonder if the llvm java frontend (.class files -> llvm bytecode) combined with the llvm webassembly support could result in a port of the google closure compiler running in the browser or on node?

dnolen20:03:19

@smw that could be interesting but certainly not useful to the typical ClojureScript user - people targeting bandwidth constrained clients

dnolen20:03:40

@smw it’s hard to imagine much in the way of speed gains

smw20:03:54

more thinking parity between bootstrapped clojurescript and clojure-hosted?

smw21:03:07

but it might just be terribly slow

dnolen21:03:11

ClojureScript is a GCed language and already has competitive performance against Clojure

smw21:03:47

Right, but as far as I know you can’t do dead code removal in bootstrapped cljs at the moment?

smw21:03:17

Maybe a native cljs port of the closure compiler is the better idea, but it looks massive

dnolen21:03:55

DCE support would really only be interesting for Node.js bootstrap target

dnolen21:03:01

and yeah - it seems like a lot of work, minimal gain

smw21:03:32

Yeah, I think you’re probably right. It’d be much more fun to show off the cljs development workflow with something as fast and simple as planck, though.

smw21:03:24

Sorry for wasting your time simple_smile Just brainstorming how to make it easier to sell. I’d like to see world domination.

dnolen21:03:36

there are a couple of things we could do to make things faster - the JVM really isn’t a problem here at all in that respect - and we’ll probably benefit if/when Clojure makes some headway as well

dnolen21:03:55

but IMO, the Uberjar is pretty dead simple - it’s really the integration for dev/prod workflow that requires some fiddling

dnolen21:03:08

but honestly we’re not doing any worse than anybody else here far as I can tell