This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-21
Channels
- # architecture (9)
- # beginners (192)
- # boot (1)
- # bristol-clojurians (2)
- # cider (213)
- # cljs-dev (10)
- # clojure (195)
- # clojure-art (2)
- # clojure-austin (3)
- # clojure-belgium (4)
- # clojure-dev (4)
- # clojure-dusseldorf (1)
- # clojure-gamedev (9)
- # clojure-greece (21)
- # clojure-italy (27)
- # clojure-losangeles (2)
- # clojure-russia (1)
- # clojure-seattle-old (2)
- # clojure-serbia (1)
- # clojure-spec (114)
- # clojure-uk (136)
- # clojured (2)
- # clojurescript (100)
- # community-development (19)
- # core-async (12)
- # cursive (7)
- # duct (1)
- # figwheel (7)
- # fulcro (96)
- # hoplon (4)
- # jobs (2)
- # lein-figwheel (28)
- # leiningen (2)
- # luminus (14)
- # lumo (3)
- # off-topic (11)
- # om-next (2)
- # pedestal (10)
- # planck (11)
- # portkey (2)
- # proton (1)
- # protorepl (19)
- # re-frame (27)
- # reagent (12)
- # shadow-cljs (82)
- # spacemacs (42)
- # specter (15)
- # sql (3)
hey thanks to all y'all helping me out, I now have a little web service that can generate extremely useful data, such as "Gandalf's music box of crafty second chances" and "an orcish sweater of courage" 😄 https://github.com/mathpunk/sherman
another one that made me laugh was "Castamir the Usurper's mantle of ubiquitous second chances"
My issue is getting the bindings to resolve to the correct cljs vars
when using my list version
wait im silly, I figured it out doing way more than I need to be lol
How does one alias a macro from namespace A to be used from different namespace B as though it were part of namespace B?
no no, I mean say I have a macro in namespace A called a.foo, and I create a new namespace B. I want to make an alias of a.foo, within namespace B such that b.foo will refer to a.foo
so when I call (:require [B :refer [foo]]), it will refer to b.foo, which in turn is an alias for a.foo
hmm, it doesn't appear to like the macros, does it matter that i'm writing the macros in a .cljc file without reader conditionals?
@benzap (ns my.lib (:require-macros [my.lib]))
this lets anyone use my.lib/foo
directly whether its a macro or a fn
so (:require [my.lib :refer (foo)])
is probably prefereed over (def foo ...)
in the ns itself?
The problem is I don't want them to use it directly, i'll be more specific, I want to wrap a logging library into shortforms which can be refered to from a local namespace
ie. I want to refer to taoensso.timbre/info from foo.log --> (require '[foo.log :as log]) (log/i "test") ;; (taoensso.timbre/info "test")
ya, i'm having troubles with the cljs side, clj seems to work, here's what I have: (defmacro i [& args] {tilde}(taoensso.timbre/info ~@args))
I think the later clojurescript versions don't need you to use :require-macros, they figured out how to infer it
its hard to keep track of what is CLJS and what is CLJ sometimes in those files but basically the CLJS version didn't know what i
was so it failed
it gets much easier to understand what is going on if you split the files into .clj
and .cljs
yeah, I see what you mean. so i'm calling :require-macros to drag the defmacro from the :clj conditional
@benzap Yeah, keeping things separate is better IMHO, but if you really want to cram everything into one file, there is a library that helps with this: https://github.com/cgrand/macrovich
Hey everyone, my name is Jacob and I have been given the task to test our Clojurescript applications. Currently, we are using "Doo" as our test runner and "Phantom JS" as our environment. One thing I have not been able to find a solution to is how to report our test results (other than just in the cmd). I know there are certain libraries available for formatting test results into JUnit test results but I have not been able to find any that integrate well with the "Doo" runner and "Phantom JS" environment. We would like to avoid using Karma and stick to Phantom JS. Does anybody have any recommendations for a solution to report clojurescript test findings?
is there a difference between ClojurScript and CLJC? in this talk https://www.youtube.com/watch?v=fICC26GGBpg is told that with Foam you have to port all ClojureScript to CLJS :thinking_face:
cljc files just allow you to have clojure specific and clojurescript specific code in one file. There's a reader macro that let's you say "if this code is run in clojure, use this" and the same for clojurescript, other than that, cljc is the same as cljs
It's just a way to store CLJ and CLJS in one file with some special switches. (I apologise if I misunderstood your question though!)
Kind of, I use it in one project to be able to use the same specs for client and server site rendering
But the goal should not be to put everything in cljc, just the bits you want to use on both sides, so in my case there are also a lot of functions taking specced data and giving back hiccup-like data structures of the components
terminals are notorious so its tough to move ahead without a decent number of folks reporting success
Working beautifully in a fresh lein new figwheel...
. I'm on Arch running Termite. https://github.com/thestinger/termite awesome work, can't wait to integrate rebel-repl in more places! Massive jump for usability.
@U38J3881W Thanks!!
I’m sure I’m not the first, but it seems to be working great in iTerm2 on macOS. I did find one interesting issue with apropos
:
dev:cljs.user=> (re-find
java.lang.ArithmeticException: Divide by zero
at clojure.lang.Numbers.divide(Numbers.java:163)
at clojure.lang.Numbers.divide(Numbers.java:3813)
at rebel_readline.clojure.line_reader$standard_deviation.invokeStatic(line_reader.clj:619)
at rebel_readline.clojure.line_reader$standard_deviation.invoke(line_reader.clj:613)
at rebel_readline.clojure.line_reader$two_standards_plus_mean.invokeStatic(line_reader.clj:625)
(that was from hitting C-x C-a
at the end of re-find
, which presumably has nothing for apropos to find)
@U07HA15PY Thanks!!
@bhauman working on a small re-frame leiningen project, only had to set the snapshot version
holy eff, sherman
has its first user other than myself! She too wants to generate text like "Tar Meneldur's blast of non-euclidean sparks"... but, she's not a Clojure user, so I'm trying to compile a server.js
file to put in a dist
directory. So far no luck. Here are my project.clj
and my build.cljs
files---
I'm referencing this post: https://anmonteiro.com/2017/02/compiling-clojurescript-projects-without-the-jvm/
but i'm not using the --classpath
right, i don't think, because while i compiled something, it throws on running it with node, because it can't find transit
oh! i have another problem, where, when I run my program I get errors that it's never heard of the namespace clojure.string
, and yet, the functions that rely on it seem to be doing their work. super weird~
@mathpunk What you are probably seeing is that, in the namespace you are working with, you are calling functions in clojure.string
without having required it. This causes the analyzer to complain with some warnings. But, they are just warnings, and the code that gets emitted happens to be correct. And at some point, something did require clojure.string
, so the actual functionality is present in JavaScript.
Ohhhh yeah that makes sense. In Clojure I've frequently found myself using a single string function once, so I just fully qualify it
Yeah, simply calling (clojure.string/trimr "abc ")
is insufficient. Even though it might work, you really need to ensure that clojure.string
is required in the namespace you are in.
this can backfire when using namespaces (including clojure.string itself) that might be loaded by your tooling but not required in a direct invocation of your jar
there’s minimal extra cost to requiring a namespace everywhere you use it, and it avoids these gotchas
Yeah, in other words, requiring a namespace essentially mutates the environment. But correct code puts all of its requried namespaces in its ns, form (for lack of a better way of putting it). One way this can bite you is, for example, if you enable parallel compilation in ClojureScript, and by chance, your namespace that is using clojure.string
gets compiled first.
On this subject, @mathpunk there is an interesting compiler option, :analyze-path
. This post might be informative and help understand this particular issue a little better: http://blog.fikesfarm.com/posts/2015-06-10-analyze-path-ftw.html
I'm glad I have learned this before getting bitten by it, because (as I've made clear in #beginners) my mental model on what abstractions belong in the language, the runtime, and the tooling is fairly fuzzy
I think that’s normal actually. 80% of the features people think come from their tools come from the language, and 90% of what people think comes from the language comes from the runtime. To make a wild estimate.
67% of @U051SS2EU’s statistics are made up on the spot 😛
I recall this subject coming up before with Alex Miller too. I was curious on the “reliability” of using some clojure/core namespaces that just happen to be pe-required on Clojure startup. If I recall correctly, he said that they are not something you should rely on. This is just reiterating what others have already said on this thread though. One relevant example that comes to mind is, eg. if Clojure was tweaked to speed up start-up time. It may be the case it “accidentally” requires a namespace right now that isn’t needed to startup. If it later removes that implicit require, your code may be broken if it relied on “some other namespace” to require the namespace for you. This same principle also applies to if you are implicitly getting a namespace loaded transitively by some library you depend on. That is an impl detail of that lib and could change and break you later. The whole subject reminds me of Maven (and probably other tools) best practice of not relying on transitive dependencies.
iirc the only one that won’t ever be absent is http://clojure.java.io but even that could be missing in some future version, and adding a require for something is basically free, so…