This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-08-04
Channels
- # admin-announcements (33)
- # announcements (2)
- # beginners (10)
- # boot (200)
- # cider (25)
- # cljs-dev (13)
- # clojure (75)
- # clojure-canada (2)
- # clojure-czech (1)
- # clojure-dev (16)
- # clojure-japan (7)
- # clojure-russia (20)
- # clojurescript (206)
- # clr (1)
- # cursive (24)
- # datascript (1)
- # datomic (1)
- # editors (2)
- # hoplon (136)
- # ldnclj (54)
- # off-topic (9)
- # om (5)
- # onyx (8)
- # re-frame (66)
- # reagent (19)
- # yada (21)
nice to see Håkan's cljs2go project on HN this morning
@malcolmsparks: Yep, I up-voted it; that man is a unique genius, and I’m being serious, there is just nothing he can’t do as far as I can tell!
@andrewmcveigh: are you around? i have a cljs-time question
to format local-dates as strings, i need to make them date-times. this appears to apply a utc modifier, turning march 3 into march 2 at 22:00. how do i stop it from doing this? i want march 3, 00:00
looks like i need to rub some cljs-time.local
on it
running the dates to be formatted for display with cljs-time.local/as-local-date-time-to-time-zone
works
Yeah, I’m here
Just catching up...
i came right
If you start with a ‘local-date-time’ the formatting should work I think.
How do you obtain the local-dates?
core/today, core/minus, core/first-day-of-month, etc
it’s all good now
thanks for a great library, btw!
cool. The local stuff is something I’ve not used personally in a while, so let me know if you find any weirdness!
I suddenly realized that with self hosted clojurescript, things like 4clojure etc can now be entirely client side
@borkdude: I’m waiting with bated breath for a full ClojureScript executable gist-like service.
something more like JSFiddle, http://jsfiddle.net
@borkdude: Yes it is very good for tutorial and learning in general. I am in the process of using it to set up a playground for one of my oss project.
@hmadelaine: cool!
@dnolen: I am struggling a little bit with cljs.js but it is good to understand how it works. I was very interested bay the discussion you had with @mhuebert yesterday. I hope a nice blog post will come 😉
@hmadelaine: I might write up something about using it but unsure there are some things that are just tricky to explain
ClojureScript JS keeps the var environment separate just like ClojureScript JVM, so this complication is just something people need to understand
but it introduces lots of brain warping issues around the fact that the thing that bootstraps does not really pass anything on to the bootstrapped thing in terms of the var environment
@dnolen: yes you talked about it yesterday. I have to keep that in mind. Thank you very much for this invaluable gift !
Is there a way to export conversations from slack ? This is a gold mine but the nuggets are ephemeral
@hmadelaine: np, I think in a couple of months or so people will have a better grasp how it works and I suspect things will move pretty quickly thereafter. This conversation has convinced me to write up a brief advanced tutorial on bootstrapping that at least covers the subtleties people are likely to encounter.
@dnolen: great
@dmich thank you very much !
Planck 1.3 is now available via Homebrew: http://blog.fikesfarm.com/posts/2015-08-04-pour-a-pint-of-planck.html
I wrote up a gist explaining what I have learned about loading analysis caches in cljs.js
(to eval code using existing namespaces in a project): https://gist.github.com/mhuebert/18a1ef480d1bb0b0a270. Of course, all feedback is welcome, I’m still learning. Many thanks to @mfikes and @dnolen for helpful conversations as I’ve tried to get this all working.
@mhuebert: One additional fun thing to consider: If the expression you are evaluating is a def
or derived from it, then it will add to the analysis cache. (This is how Planck does tab completion on things you define at the REPL, for example.)
@mhuebert: (Instead of let
ing the state, you can do a top-level def
of it and keep it around—it is an atom internally.)
(It is also fundamentally how bootstrapped REPLs don’t complain when you try to call fns defined in the REPL.)
@mfikes: good point. Understanding that the compiler state is an atom is also very helpful for debugging- I found myself going in there to see what was being defined, etc
@mhuebert: thank you very much ! I will put this into practice tomorrow It will save me a lot of time !
and is a 55 line fnction considered too long? even if there are no clear reusable parts?
@exitcode0: letfn
isn’t discouraged. It’s just not often used. People tend to prefer just letting a fn (like (let [my-fn (fn [] ..)] …)
) unless they need recursion.
Length of a fn is in part a stylistic choice. But breaking it up isn’t all about reusability (i.e. how many times will this chuck of code be called). It’s about simplicity (i.e. is this chuck of code one thing). Reusability informs simplicity, but it doesn’t define it.
I tend to try to put an emphasis on simple functions, regardless of length. If I’ve broken it up as far as I can, and it’s still hard to read, I might let
a variable or a fn, give it a good name as documentation.
@potetm here is the code in question http://pastebin.com/
I am being informed right now that I should divide up the individual html elements being drawn on the page - this one function is the only place they would be called though
What you can do is move static styling to css. That’ll create a little let line noise if you’re worried about that. That’s somewhat stylistic, but I tend to prefer it.
I would also use let
instead of letfn
there. And I would inline the short callbacks to bring them closer to the invocation point. But that’s all stylistic. You do what you prefer.
On the whole though, it seems to be centered around one thing. Which is the most important part.
I mean I would move them down into the dom declarations so it’s clearer what each callback does.
is it possible to put a "defn" inside of a function or are you forced to use a let or letfn
@exitcode0: not possible, defn
def
declare
all these things must be top-level
@dnolen: Is there some kind of fundamental difference there between clj and cljs, or are you just worried about confusing semantics in both cases?
thank you for the response dnolen : ) http://giphy.com/embed/MUeQeEQaDCjE4
@wildermuthn: Any luck with your issue? Wondering if tap works in a side-effecty way, and if you should be using its return value, or the original channel you passed in to be tapped
turned out to be a problem with a logging macro!
macros can be evil, hah 😉
Hey, cljscriptians! How do you store form fields and validation errors? Records, meta or something else?
generally, I have a central app state
that is a simple atom that tracks the application state.
dnolen: are you transferring ownership of the mies template project?
@shaunlebron: I haven’t yet but if somebody wants to take it happy to give it up
I won’t volunteer for it yet, but just wondering since the cljs unraveled book is referencing it as the quick way to get started on leiningen
so anyone here who wants to maintain it, let us know!
@roberto: thanks, I also think validation errors should be in state. Neither record nor meta, just plain map. I am trying https://github.com/leonardoborges/bouncer
and initially build (defrecord FormField [value error]). It requires some ceremony to extract values for validation, I think I'll just drop validation results in state
interesting, hadn’t seen that. I normally just have my own validation functions and the output is placed in the state. For example:
(def app-state (atom {my-model: {}
errors: {}}))
and there may be global errors (base in rails) like two email fields are the same while should be unique.
I was started with my own too, very similar to bouncer. Don't want to reinvent the wheel
@shaunlebron: well mies is leinengen-less now, only the Quick Start approach
@shaunlebron: far as I can with the Lein the fastest thing by far as is Figwheel
@dnolen: oh I didn’t notice that, does the current mies setup work with dependency retrieval?
that’s the main motivation behind moving to leiningen in this book, for transitive dependency installation that lein provides
@shaunlebron: ah yeah it only uses lein for deps
oh, great!
replacing mies in the book with figwheel might be an option. I think it would be really valuable to see those build scripts though
@shaunlebron @dnolen: I would be happy to maintain it, if that would be ok with you?
awesome
only two versions behind though
and yeah dnolen, you just don’t do enough 😉
@dnolen: what’s the best way to go about it? will you just add me as a collaborator to the project?
@shaunlebron: is putting the scripts also in the figwheel template also an option?
@bensu: hmm, maybe?
I don’t know enough about cljsbuild, but I think figwheel is a fork of it. If the build scripts were added to the figwheel template, I would hope that they produce the same files, for consistency between lein figwheel
, lein cljsbuild
and script/build
and are configured with the same data
syncing the compile settings between them might be troublesome
(brb)
the template could use a little work to add Emacs integration and I thought I could add the mies scripts in the process.
@maria: I can also pass ownership to you, I think GitHub is good about redirects if you do this.
Maybe also a good match to move into some org like cljs-info? (just a thought)
@martinklepsch: @shaunlebron: that’s also a cool idea, but I leave the final decision to @maria
definitely
I wouldn’t move it under cljsinfo, that’s mainly for website stuff, for now atleast
wouldn’t be bad to create a clojurescript org
actually, I’m not sure how much stuff would go under a clojurescript org, I’m fine with cljsinfo filling that role
up to you @maria
@dnolen: I would be happy, if you would just add me as a collaborator for now. Should be the easiest for now and then we can still move it later if we want to 😉
Hey guys, totally off topic here, anyone know how I would go about accessing the eval-str method in cljs 1.7?
@jonr there’s really not much beyond the docstrings in cljs.js
- but I’ve gone out of the way to make them clear
I was just expecting to be able to use eval-str from the console via cljs.js or something
is cljs.js not exposed to js? I was thinking i would be able to access that in the browser console
@jonr I don’t know what you mean. It’s not any more exposed than any non-core ns, like clojure.set
or clojure.zip
oh you wanna do cljs.js.eval_str(…)
in the browser console
Generally I am wondering if these most recent cljs updates would allow for an in browser cljs repl instead of connecting through figwheel
bootstrapped ClojureScript cannot reasonably be optimized beyond simple so top-level names don’t ever get munged
seems like it should be doable without too much. Seems like you've done the hard parts 😉
would an in browser cljs REPL be cool? I have been marinading on it today trying to think about if that would makes sense in tandem with figwheel file watching, compiling and updating source maps etc
@jonr Joel Martin actually has got one up and running here http://clojurescript.net
@jonr one thing to consider is that Clojure(Script) programmers like to work from their source file
the only time I use the browser REPL is I have to debug something in a frame because I set a breakpoint
great feedback. I have been battling with figwheel and emacs as of late so that got me thinking about other options
for other dev tools like snippet sharing or a http://jsfiddle.net clone, yes a browser based REPL would rock
really it just seemed like these updates should make it pretty easy and it sounded fun to make
thanks for sharing the link. That might be enough to get me started towards a proof of concept
@dnolen @maria, would you be open to curating and maintaining all lein/boot cljs templates in a single org?
I maintain a few lein templates, and I know many boot based templates. Rather than expecting new cljs developers to figure out where these templates exist, we can maintain them in an org.
@pri: I don’t have a problem with that, but I’ll let @maria sort out when / how that should happen
@pri: I’m not a big templates person so I don’t have strong opinions about these things
@dnolen: please know, many cljs developers (including myself long back) started their life with templates
@pri: I think where those templates are maintained is not really important and a documentation/index site for the various choices might be a better option?
@martinklepsch: an org can facilitate that in its site.
Weird cljs.tools.reader
behavior... is this by design?
cljs.user=> (cljs.tools.reader/read-string "017") ; octal number
15
cljs.user=> (cljs.tools.reader/read-string "018") ; number format exception?
18
@aengelberg: looks like a bug, evaling 018
in latest cljs causes reader exception
ok. I should submit a jira ticket then
Sorry, didn't mean to interrupt. wasn't sure if there was another more appropriate channel for this.
@aengelberg: that throws an exception in Clojure too
in clojure.tools.reader
it throws a NullPointerException. That might be a totally separate issue
@aengelberg: yeah that sounds like a bug, but not throwing on invalid octal, this seems intentional
@aengelberg: Bronsa on Clojure IRC is the one to talk to
I’ve added a new wiki page for ClojureScript project templates: https://github.com/clojure/clojurescript/wiki/ClojureScript-project-templates
there are some others here as well https://github.com/clojure/clojurescript/wiki#project-templates
might make sense to move the templates higher and include in sidebar since new users benefit from them a lot?