This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-10
Channels
- # admin-announcements (4)
- # aleph (1)
- # beginners (29)
- # boot (112)
- # braveandtrue (1)
- # cider (44)
- # cljs-site (1)
- # cljsjs (2)
- # cljsrn (1)
- # clojure (46)
- # clojure-gamedev (3)
- # clojure-germany (1)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-russia (20)
- # clojure-sg (2)
- # clojure-uk (14)
- # clojurescript (228)
- # cursive (41)
- # datascript (5)
- # datomic (17)
- # editors-rus (48)
- # emacs (3)
- # flambo (1)
- # hoplon (9)
- # jobs (2)
- # kekkonen (1)
- # lein-figwheel (1)
- # luminus (5)
- # mount (11)
- # nrepl (3)
- # off-topic (7)
- # om (12)
- # onyx (139)
- # other-languages (54)
- # planck (1)
- # proton (17)
- # re-frame (37)
- # remote-jobs (1)
- # rethinkdb (9)
- # ring (2)
- # ring-swagger (6)
- # test-check (1)
- # uncomplicate (8)
- # untangled (2)
is there a way to introduce environment variables in clojurescript? ie dev vs prod variables
risto I guess when you enter a process there are ways to catch the vars. like *1 *2 so you can check which env you are and load the namespace of the correct env
that's how I would've solve it
@vinnyataide: How would you go about it more specifically? the issue is the ClojureScript is compiled into JS, so it needs to be passed into closure somehow, but I don't see any options to pass in environment variables
The only solution I can think of is having a separate externs file for dev and prod that exposes the same namespace, and including the right one for each
no man
the problem with dev and prod should not be an issue for the app
just for the tooling
check leiningen if it doesnt have any way
only server and build tools care about env in my way of view
maybe I can be wrong
@risto now I'm having trouble understanding what reify stands for and those names in om like
om/ICheckState om/IInitState
Basically I'm using figwheel to develop my app, but it runs a server that serves the websocket connection, but in prod I have no server (it's all client-based)
how does one return equivalent of ^:export
, which is a reader macro from a ClojureScript macro ? e.g.
=> (defmacro example [fn-name-expr] `(defn ^:export ~fn-name-expr [arg1# arg2#] true))
#'boot.user/example
=> (macroexpand-1 '(example foo))
(clojure.core/defn foo [arg1__6814__auto__ arg2__6815__auto__] true)
For example, I have the path /levels
and /resources/public/js/src
. In prod, it can fetch /levels
without a server same-domain by just using the relative path ../../levels
. In figwheel, it says localhost:3449/levels/...
doesn't exist.
could I do this maybe ?
=> (defmacro example [fn-name-expr] `(vary-meta (defn ~fn-name-expr [arg1# arg2#] true) assoc :export true))
#'boot.user/example
=> (macroexpand-1 '(example foo))
(clojure.core/vary-meta (clojure.core/defn foo [arg1__6825__auto__ arg2__6826__auto__] true) clojure.core/assoc :export true)
To clarify, obviously there's a server that serves /levels
, etc (the app itself), but what I mean is that it's not my server but a remote one that just serves files statically, so I can't hook figwheel to it directly
@superstructor: I'm given to understand that with-meta
is the correct function to use.
@cky ok thanks I’ll try that
@risto: Maybe you could use closure defines https://github.com/clojure/clojurescript/wiki/Compiler-Options#closure-defines
@risto I'm wondering where you're going to run if you get no server to serve the cljs files
@cky: hmm but :export true
appears to be on the fn not on the ~fn-name-expr
? and won’t using with-meta
vs vary-meta
overwrite other metadata ? (see snippet)
@vinnyataide: It's a simple browser game that requires no server (for now): https://github.com/Risto-Stevcev/sokoban
So this game could run as a native desktop app? or a website, anyways, I dont know anything about publishing apps in cljs, gotta read about that, awesome game btw
from a begginers perspective I'm impressed by the complexity of the code. I can't read most part of it because the logic is so functional
@risto you used this virtualdom lib. is it a more low level way to interact with the dom besides react wrappers?
Yeah, it's only slightly more low level. You need to create a wrapper for diff and patch, which react does under the hood.
I don't want to use React because I'm boycotting it's PATENTS clause (I know the ClojureScript community has a love affair with it)
I would use snabbdom over virtual-dom because it's faster, but it wasn't in the CLJSJS package list. I'll probably submit a pull request to include it
nice man
@vinnyataide: regarding your first question—from what I can tell, the ClojureScript story on react/redux/graphql is still an open research problem. Om Next, re-frame (built on reagent), posh (built on reagent+datascript), rum (which is a wrapper to Om Pre + reagent, also by the datascript author) are all trying to figure out the best way to do all of these things. Some parts are more advanced than others in some of these libs. Rum has server-side rendering. Om Next has working graphql-style post-modern (i.e., not REST) client-server synchronization. Re-frame nails the redux story (it preceded Redux by several months, I suspect Dan Abramov read re-frame's famous readme in his sleep).
Probably, hopefully in a year or so, significant progress will be made towards holy grails.
Right now, plenty of people are making totally functional apps, but they're probably compromising on one aspect or another of the eventual paradise of web development we all seek.
@fasiha: what about subscriptions? does any of them cover it?
@vinnyataide: re-frame has subscriptions.
no component dependecy
declaration
all right
Yeah. Orthogonal to these frameworks is sente
, btw, which is a great library for delivery push notifications to clients.
I was wondering if the authors of reagent were considering moving to a declarative query syntax like om.next for components
I like that idea from om.next but I just dont like om in generl
I hope thats in reagents road map though
@sbmitchell: reagent is all about ratoms, it's a totally different paradigm
I suppose that is true
you could do something on the re-frame side as far as the subscription model then
perhaps reagent internally does not need to add these things
Seems like your subscriptions could be tailored to accept a graph ql syntax and you could have some fn to parse it and get data as you wish
not sure.. just spit balling
Reagent can probably be seen as a thin wrapper to react. It doesn't have post-react ideas like a central app db like redux/re-frame/posh. Which I think is good—let the bottom-most lib be unopinionated and let the layers on top be more so.
I agree with that
yea thinking more about that reagent wouldnt be the right place for that..the data model is a concern for the framework that deals with data
reagent components in general should be dumb as bricks
so re-frame is probably where this kind of thing would need to happen
@fasiha: The biggest sell of reagent (for me) is that, if you are disciplined, it's just hiccup. If you don't lean on React too much you can reuse the same code for server-side rendering.
What dont you like about om?
I really liked the david nolens talks
to be fair I did not give om a fair shot
I like david nolens talks for sure
hes a guy I look up too for his ideas and passion for front end
he semmed very sure of what he was building
I think if I was given a better story as to how to work with hiccup inside of om
I may have picked it up
there's a lib to work with hiccup
a year ago
it translates to om
reagent was more accepting
1 yr ago
for me anyway
and thats just what I work with now...so I have a bias
the thing i dont understand from om is those names
@vinnyataide: Om (especially om.next) will never be "just hiccup"
i dont know what they mean and their purpose
and the multimethod too
there were issues with om...so im kind of thankful I didnt go down that route
bc then id have to worry about moving to om.next
what issues?
om at scale and having the data structure needing to map to the ui structure
thats why om.next models stuff as a graph
so cursors in om were terrible apparently?
and core.async being used everywhere was not great
thats so strange
nolen did mention this at conj that I went too
bec so many things use the concept of cursors
I think circlci had a good article about it
let me try find it
all right
im from brazil so I can only see by youtube ;{
anyway..all the problems that did come about are being addressed in om.next
our shop is probably looking for people we are a clojure/cljs shop heh
but we are using reagent
good article
pretty hard to find clojure devs and then clojure devs that dont mind working in clojurescript
Just today I'm getting ready to release a cryptography I've been writing in clojurescript/clojure for doing ECDSA
I still am not understanding the presence of those "directives" I think it is, looks like an interface
om/ICheckState om/IInitState
awesome man
I mean, not awesome to find a bug
Yeah I have some criteria about testing necessity but low level stuff is really in the critical part for testing
I dont mind cljs mainly because when we live with js this is one of the best ways to go, besides elm
I really like the lisp thing
really got me
never saw before
dart has suffered from that
I was a dart dev for some time, in the angular golden era
jesus
scala is scary
like go or rust
lol yeah
Eh, before I was a clojure programmer I programmed Haskell, and before that I was just a mathematician doing computer assisted proofs, Scala doesn't scare me.
install eclipse and youre good to do 💩
yeah haskell is beautifully scary
hahahaha
I gotta finish this datalog tutorial but the interpreter is broken ❤️
its showing some regex msg error
@vinnyataide: uhh yeah, that's very frustrating. But that tutorial only covers queries, not transactions, which are important too. There's a crippling dearth of beginner tutorials stuff but check the last couple at #C07V8N22C for some reasonable reading material.
Let me actually write a gist on how to get http://learndatalogtoday.org working in a local repl. Datascript runs on JVM too, so I'm just doing all my exploration in JVM repl
dangit im reading all those tutorials and getting all dizzy, maybe I need to learn all those cljs special characters
cool!!!!
thanks
Oh. Datascript/Datomic have a ton several special datascript/datomic-only characters that aren't Clojure-specific 😞
@fasiha: I've thought about using DataScript, but I'm scared that it's too heavy. How much does it add to your javascript payload in production?
Sorry I have no idea. If it saves me from having to write REST endpoints and two separate queries (frontend vs backend), I'll be happy to pay in page load time. Provided it doesn't drive me to drink.
thanks fasiha
Im looking at the symbols and some arent clojurey
interesting to say that there is another realm of languages, is SQL a logic lang too?
SQL was a simplification of datalog (a simplification of prolog). SQL did not originally have the power to do recursive queries like datalog could, but after many epicycles they are equally powerful as query languages go.
@superstructor: Does
(defmacro example [fn-name-expr] `(defn ~(with-meta fn-name-expr {:export true}) [x#] x#))
work for you? I don’t have a good macro setup for ClojureScript at the moment but some manual expansions suggests it should work.@cky thanks again, I think you are right. That looks like it could work, I’ll need to compile everything and look at the output to double check.
oh nice insight
@superstructor: Cool, lemme know how it does. That seems to replicate your original code most faithfully.
(i.e., attaching the meta to the symbol being defined, rather than to the defined result)
@cky yep will let you know, it just needs to be compatible with this when it eventually reaches emit*
https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/compiler.cljc#L636
Does anybody have experience in wrapping koa.js in cljs? Planning to write my first side project in cljs and i'd like to go with a node api server. tips?
@nicoschneider: Doesn't koa use generators? I don't think clojurescript supports those, but I might be wrong about that
hi people! quick question, can somebody pls point me to examples how to use js*
from within a macro pls? i just can't get it to work and there're close to zero docs.. am aware this is not to be used directly, but am prototyping some ideas and am slowly despairing... the whole cljc changes made macros in cljs even more confusing - thx!
I think the main trip up around js*
is that if you’re going to generate an expression you need to make sure it’s js*
and not cljs.core/js*
@toxi https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/core.cljc#L708
@dnolen oki, thx - i did take a look & this is where my confusion stems from (/src/main/clojure/cljs/core.cljc)
@dnolen - ha but your hint re js*
vs cljs.core/*js
very much helped... just solved it like this: (defmacro foo [x] (let [js 'js*]
(js (str "/ " x " */"))))`
@dnolen: yes, clojure types will simply be wrappers around pointers and then delegate to asm.js fns
Oh gods, Elm removed FRP and added subscriptions: http://elm-lang.org/blog/farewell-to-frp </minor offtopic sorry>
Yes - it is the top story in HN right now: https://news.ycombinator.com/item?id=11667523
@risto: in reference to you server path issue, I think your slight miss-understanding is that there is a server even with a static site. So if you want prod to match up with dev you will need a development static server with the same path setup as production.
so in your case I would run a dev static server separate from figwheel that delivers files the same way your production setup will. Figwheel will automatically connect to the development env.
@bhauman: Yeah, I realized that yesterday night when I was talking about how there is a server that's servering the files but it's not mine. I'll just change it to just use the lein static server and hook it up to figwheel
I'm glad though that I found out that there is a way to do something like lein-environ for the frontend. It might come in handy someday, who knows
that is awesome, in the outside mainstream world I dont really focus on the build tools to manage my production. I just manage through an outside script that update some files
Oh shit bhauman and dnolen. I am having a nerdgasm right now.
Anyone using CIDER + boot-cljs-repl? I'm getting a NullPointerError. Works fine when running (start-repl)
from a CLI boot-launched REPL, but not after a cider-jack-in
.
Are there some known versions that I should downgrade to? I'm running on CIDER 0.13.0-SNAPSHOT at the moment, and adzerk/boot-cljs-repl-0.3.0.
@vinnyataide: Yeah, I'm glad that they're approachable. The ClojureScript community seems pretty awesome
Stacktrace: https://gist.github.com/pataprogramming/3026a87105302850490b6fddfa7e768e
why is cider asking to install 0.13.0-SNAPSHOT if the github version only goes till 0.12.0
MELPA vs. MELPA stable.
It's extremely annoying to get an Emacs setup that mixes packages from two repositories...it will always try to grab the highest version number, unless it's pinned.
I haven't had any problems running off of MELPA (non-stable) for the last six months, but it's been pretty bad at various points in the past.
Im moving to melpa stable now since I cant dowload cider 13 in my .lein conf
Recent versions of CIDER will automatically inject the deps, so you no longer have to maintain them in your profile.
So, you can try just removing the CIDER deps (including refactor-nrepl) from your Lein profile, and doing a cider-jack-in
.
CIDER 0.13.0-SNAPSHOT has been working great for me. But I might have to downgrade if I can't figure out this cljs REPL issue.
.you mean the dep right? not the plugin
The cider-nrepl
plugin? It will be automatically injected.
I used to launch REPLs by hand for more control. No more...since I switch to using jack-in, the dependency injection keeps all the versions in sync.
Hi all, im trying to build a react-native app using re-natal and reagent. 1) is there a channel somewhere for this 2) im having some issues with node finding a library that it thinks it wants.
worked it out. spelt the library name wrong 😞