This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-02
Channels
- # aws-lambda (1)
- # beginners (28)
- # boot (54)
- # cider (11)
- # clara (28)
- # cljs-dev (74)
- # cljsrn (13)
- # clojure (342)
- # clojure-austin (3)
- # clojure-dusseldorf (4)
- # clojure-france (2)
- # clojure-greece (11)
- # clojure-italy (42)
- # clojure-poland (7)
- # clojure-russia (11)
- # clojure-spec (44)
- # clojure-uk (156)
- # clojure-ukraine (4)
- # clojurescript (102)
- # cursive (17)
- # datascript (19)
- # datomic (17)
- # dirac (39)
- # emacs (22)
- # funcool (56)
- # hoplon (25)
- # jobs (3)
- # jobs-discuss (31)
- # leiningen (2)
- # luminus (4)
- # lumo (3)
- # off-topic (47)
- # om (51)
- # onyx (57)
- # re-frame (13)
- # reagent (57)
- # remote-jobs (15)
- # ring (9)
- # ring-swagger (7)
- # robots (2)
- # rum (6)
- # specter (16)
- # sql (7)
- # test-check (37)
- # untangled (7)
- # yada (5)
hello guys, am getting this assertion error when in try to compile my cljs (Assert failed: Circular dependency detected, re-frame.interop -> reagent.ratom -> reagent.impl.util -> cljsjs.react -> cljsjs.react) , i tried to exclude reagent/ratom from the reframe dependency but i still got the same error
How can you check if something is a ClojureScript object or "plain" JavaScript?
@tech_hutch cljs.core/map?
if by “ClojureScript object” you mean a map
But that will return false for vectors, won't it?
I mean maps, vectors, sets, etc.
Basically, anything ClojureScript defines.
I guess I could check each individually--`string?` map?
vector?
etc.
Actually I guess strings are plain JS strings
hrm, I think cljs.core/coll?
will tell you if you have a ClojureScript data structure
Okay.
Thanks, that seems to be what I need!
In JavaScript, evals will have access to surrounding variables in the scope that eval() was called in. Is it possible to do the same in ClojureScript? It doesn't seem to see them.
Come to think of it, I suppose I could pass any JavaScript function to eval it with, so I could have one that makes the variables in the enclosing scope.
@tech_hutch for ClojureScript object detection try to look here: https://github.com/binaryage/cljs-devtools/blob/master/src/lib/devtools/formatters/helpers.cljs#L55
and I don’t think you are correct with the statement "evals will have access to surrounding variables in the scope that eval() was called in”, javascript eval has only access to global scope I believe
@tech_hutch CLJS does many things to ensure sane scope semantics, that means it will sometimes introduce new scopes and re-bind variables (especially in loops). generally you should probably try to avoid eval
thheller: "CLJS does many things to ensure sane scope semantics" so variables introduced with, e.g., let
cannot be accessed from an eval string? And I normally wouldn't use eval (in this language or others), but I have a use.
I'm using Node, so I'm not using :advanced
.
but with :advanced
that will be something else entirely, so stay away from eval
as best you can 😉
anyone know of a lib that simply provides all math functions as cljc ? e.g. #?(:clj (Math/round x) :cljs (js/Math.round x))
etc
-- oh hey it's ok...i didn't know you can do Math/math-fn in cljs too
hmm yes in JS there are some different signatures
so maybe it would be better to hand-code each variant in cljc
Should the Javascript Module support (https://clojurescript.org/guides/javascript-modules) work for the browser as a target or is it for :target :nodejs
only right now?
@kommen that said, really the JS module stuff is about the browser - under Node.js you don’t need advanced compilation
(This is for a Discord bot, by the way.)
seems dangerous to use eval for anything that might see user input but as far as eval is concerned it should work
The only user input here is mine.
Sorry, I should have said this is for a Discord selfbot.
Is there metadata you can apply to a function definition that prevents it from being dead code eliminated?
Yes, this is on Node
So vm
is a built-in Node module? I haven't used it.
@dnolen ok thank you. I just thought I read something that it works for nodejs target only for now, but couldn’t find and and also couldn’t make it work with boot
I'm not sure vm is really necessary. I don't really need to constrain the eval.
Actually, I guess I could set the variables I need as the sandbox.
From my understanding, that would make them globals in the eval, right?
Hello all. Question about setting up a pipeline with core.async. I have code that takes on the following shape:
Is there a more idiomatic way to write this?
oh. it seems to work. I thought only the <! and >! needed to be wrapped in a go block
in clojurescript nothing in core.async works outside a go macro. (please correct me if Im wrong)
put! works
that seemed to work just fine without any go block
just to confirm, that’s ClojureScript and not Clojure
thanks for clarifying
It all happens in #om
The #om-next channel is much quieter
I was just trying the keyword-map
macro from https://github.com/plumatic/plumbing/blob/master/src/plumbing/map.cljx#L104 in the repl at http://clojurescript.net, but it always seems to return an empty map. Does anyone know why?
(I'm just copy-pasting it into the repl.)
How can we build better "first contact" experiences for new programmers and Clojurians? Our open source learning group is hosting the free online webinar Essential Klipse this Saturday at 7 pm UTC to address that question. Everyone is welcome! http://discuss.thevalueoflearning.org/t/webinar-discussion-2-essential-klipse/39?u=jay
@tech_hutch I don't think you can use #js but you can wrap the map with JSValue
to get a js literal
Okay. So JSValue is a constructor, I'm assuming?
(I don't think I'll use the macro, since it's only one time, but thanks anyway)
Do I have to do something different to include goog.labs
namespaces compared to other goog
namespaces?
https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/engine.js#L23
@jr: I must be doing something wrong then - :require [goog.labs.userAgent.util]
should work, right?
Ok thanks - must be something else going on then
cljs.user=> (require '[goog.labs.userAgent.util :as util])
nil
cljs.user=> (util/getNativeUserAgentString_)
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"
@shaun-mahood FWIW, in Lumo:
Lumo 1.1.0
ClojureScript 1.9.456
Docs: (doc function-name-here)
Exit: Control+D or :cljs/quit or exit
cljs.user=> (require '[goog.labs.userAgent.util :as util])
nil
cljs.user=> (util/getUserAgent)
""
I'm trying to get openlayers to compile with Clojure, day 3 of learning what I don't know and figuring things out - error driven development 🙂
They have their own google compiler utility, so my hunch so far is that they're doing something "interesting" that I haven't figured out yet.
@shaun-mahood you might find the cljsjs package for openlayers enlightening https://github.com/cljsjs/packages/tree/master/openlayers
@olivergeorge: I'm using it without success so far 🙂
Note the deps.cljs uses :libs not :foreign-libs
It's been a while since we used that. Not sure I can give comment on current status.
There's half a chance there's code in this old repo which might give you helpful clues
https://github.com/condense/archived-openlayers-om-components https://github.com/condense/archived-example_openlayers_cljsjs
Oh that might totally help - a lot of the things I've been looking at are areas I haven't had to use much (I spend most of my CLJS time without needing to do any interop), so having another reference is awesome. Thanks!
@shaun-mahood Good luck! This stuff is a bit interop heavy.