This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-06
Channels
- # admin-announcements (1)
- # alda (2)
- # beginners (5)
- # boot (59)
- # clara (6)
- # cljs-dev (40)
- # cljsrn (32)
- # clojure (28)
- # clojure-austin (1)
- # clojure-belgium (67)
- # clojure-greece (60)
- # clojure-ireland (1)
- # clojure-japan (1)
- # clojure-russia (55)
- # clojure-spain (14)
- # clojure-spec (39)
- # clojure-uk (26)
- # clojurescript (152)
- # clojurewerkz (1)
- # cursive (21)
- # datomic (3)
- # dirac (15)
- # emacs (7)
- # events (2)
- # funcool (4)
- # hoplon (43)
- # immutant (1)
- # lambdaisland (1)
- # lein-figwheel (6)
- # leiningen (1)
- # off-topic (1)
- # om (23)
- # onyx (67)
- # other-languages (6)
- # pedestal (7)
- # planck (13)
- # proton (3)
- # protorepl (2)
- # re-frame (6)
- # reagent (5)
- # ring-swagger (6)
- # spacemacs (1)
- # specter (2)
- # yada (27)
Hi, playing around with cljs.spec. I can currently instrument individual functions however when i call functions to do with multiple vars such as instrument-all, instrument-ns or speced-vars i get a null pointer exception. Sorry if this is nooby!
@leeondamiky: not nooby - cljs.spec is very new - show a minimal example of the problem and the corresponding stacktrace - thanks
Apparently (identical? :a :a) => false
in but not . Is this intended behavior?
"ClojureScript keywords are not guaranteed to be identical?, for fast equality testing use keyword-identical? "
There is idiomatic ClojureScript wrapper for Angular2 ? I'm thinking about something similar to the ReactJS ones like OmNext, Reagent or Rum. I'm mostly interested into the cross-platform renderer support available into Angular2 platform (not just a web framework anymore!) targeting mobile (ex: NativeScript, ReactNative) & desktop (Windows 10 UWP, ElectronJS ).
Need a suggestion, which is the right combination to use semantic-ui, raegent+semantic-ui , or om+semantic-ui?
@rnandan273: I guess the question is if you prefer Reagent or Om 🙂
I'm (unsuprisingly) having some trouble with trying to use cljs.spec from bootstrapped clojurescript
i would prefer reagent or re-frame,
I'm using replumb, added a load-fn!
based on XhrIo
, and some server side code to hook up to it, so far so good
starts off well:
load-inlined: {:name cljs.spec, :macros nil, :path cljs/spec} core.js:130:8
load-inlined: {:name goog.object, :macros nil, :path goog/object} core.js:130:8
load-inlined: {:name cljs.core, :macros nil, :path cljs/core} core.js:130:8
load-inlined: {:name goog.string, :macros nil, :path goog/string} core.js:130:8
load-inlined: {:name goog.array, :macros nil, :path goog/array} core.js:130:8
load-inlined: {:name goog.string.StringBuffer, :macros nil, :path goog/string/StringBuffer} core.js:130:8
but then I get
WARNING: No such namespace: cljs.core$macros, could not locate cljs/core$macros.cljs, cljs/core$macros.cljc, or Closure namespace "" at line 2513 core.js:152:8
WARNING: Use of undeclared Var cljs.core$macros/mod at line 2513 core.js:152:8
ERROR - cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2 is not a function core.js:63:8
TypeError: cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2 is not a function
I suppose the macros from cljs/core.cljc
aren't loaded, but it's not trying to load them either (=> :macros nil
)
I have a weird problem, my production build started dying in Chrome and Firefox (it works in Safari) with an exception 'q is not a constructor' in this function:
g.$a = function() {
return this.i + 1 < this.J.length ? new q(this.J, this.i + 1, null) : null;
};
I have determined that this is implementation of rest
on IndexedSeq
, which looks like that:
(-rest [_] (if (< (inc i) (alength arr))
(IndexedSeq. arr (inc i) nil)
(list)))
Also, this q
thing is actually a DOM object - <div class="product-info">
. It has no id, and I'm really puzzled at what's going on here. Any ideas what can cause that? Changes from release where this not happens to release where this happens are pretty small and don't do anything weird.This looks like an unfortunate case of renaming, since build where it happens has wildly different names of everything 🙂 (compared to the one where it doesnt)
@asolovyov: any chance you can share a minimal cljs failing example?
@rohit: I don't think I can! Actually, when I build this locally, it doesn't happen!
@asolovyov: so the builds on your dev box and production box are similar but somehow the latter one fails? am i getting that right?
weird... it seems I'm building same version, but it still is a bit different. I wonder if Gitlab somehow reuses artifacts of previous compilations?..
I've copied production build locally and it doesn't generate the same error it does on staging
@asolovyov: it does look weird
try setting the :pseudo-names
option. https://github.com/clojure/clojurescript/wiki/Compiler-Options#pseudo-names
@asolovyov: it looks to me that you are using some external js objects in your cljs code but the compiler isn't aware of them.
also, I had no problems like that for almost a year, and last release somehow triggered that
it could be that a new version of a cljsjs packaged lib is missing an extern. but all this is highly speculative
well, between failing and not failing release I have 4 commits in total, and all of them look really innocent. I guess I should try building every one of them as release. It really sucks that I can't verify anything locally - uberjar + cljs compilation cause release to take quite a bit of time...
@asolovyov: agreed.
hey guys, is there a way to get autocompletion for google closure libraries when working with a clojurescript repl?
@dgellow: just tested it here, and Dirac does not support it in current version, but I could make it work: https://github.com/binaryage/dirac/releases/tag/v0.6.0
Ooooh, I can see on your screenshots that with dirac you have completion for js/…
functions right?
not sure how Cider implements code completions for cljs, but it won’t be easy to do to without talking to something like devtools connected to chrome via remote debugging protocol
@asolovyov: are you wrapping your output? :output-wrapper true
is the compiler option I believe
@aengelberg: intended, use keyword-identical?
, it’s not really possible to do the keyword interning in ClojureScript to make that work
but yes, I'll have to try that I actually found commit which causes that but it looks absolutely innocent
@leeondamiky: http://dev.clojure.org/jira/browse/CLJS-1671, will look into it, thanks for making that
@dnolen: is it possible to import two different enums from Google Closure if they have same name - EventType?
@asolovyov: that doesn’t sound likely
@asolovyov: I thought you were describing a bug - are you talking about something you are trying to do that doesn’t work?
@asolovyov: yes I suspected as much
@asolovyov: it might be reasonable for production builds
if I’m dispatching a multimethod on a vector, e.g. (defmulti foo (fn [a b] [a b]))
, can I specify a default value for one of the elements in defmethod
?
@dnolen: thanks 🙂
@anmonteiro: What are the contents of the vec?
the first one would be a keyword or nil, the 2nd always a keyword
I suppose I can make it work using get-method
in the defmethod :default
You can ask isa?
question on vector, yes. Which you can use with make-hierarchy
and :hierarchy some-atom
that you pass to defmulti
.
@rauh: I was thinking about declaring methods with e.g. [nil :default]
as a dispatch, and in the default defmethod ask for a (get-method foo [nil :default])
should work
there’s an example of it here: https://github.com/circleci/frontend/blob/52920ff80942305ca4d1421e8ac8493e0467c111/src-cljs/frontend/controllers/api.cljs#L51
Yeah that's also a good idea! @anmonteiro
I don’t have to mess with hierarchies this way 🙂
@anmonteiro: Added this pattern to clojuredocs: http://clojuredocs.org/clojure.core/defmulti#example-57558046e4b0bafd3e2a0474
@rauh: looks nice! let me try
when and why is clojure.spec advantageous compared to pre/post assertions?
@rauh: there’s one catch
because we’re implementing a default method now, if there’s no specific implementation, get-method
will return the default impl and stack overflow 💥
so we need to guard against (= recover (get-method xyz :default))
@danielstockton it does a lot of stuff beyond checking fns - you can parse code, generate test information, get free property based testing, share specs, ...
@dnolen knew all those things, does that mean there is really no reason to use pre/post conditions anymore?
@danielstockton: they just seem complimentary
doesn't that mean you're effectively writing the same thing twice? is there any benefit to that?
but if you have the function instrumented, it will already throw an exception
i see, so instead of using instrument i should use :pre/:post with the spec
they seem to achieve basically the same thing
ok, i think that answers my question then spec -> documentation, generating tests, sharing specs pre/post -> throwing exceptions when specs aren't met
something like that - none of this cast in stone - it’s just my take based on what’s been written so far and the implementation of clojure.spec / cljs.spec
yeah, im sure it will be clearer when more people start using it and writing about how they're using it, but i think you put me on the right track, thanks
hmm, if i use s/valid? in a pre/post i just get assert failed how could i retain the helpful exception from instrumenting?
don't think there is any danger in my case, since the project is intended to be open source, but i guess im trying to make clojure.spec solve different problems than it was intended for
@danielstockton: if it doesn’t matter for your project - then sure just instrument over pre/post
it’s like bootstrap - use it if makes sense and the repercussions / costs are not a big deal
I understand that Clojure's format
is a wrapper for Java formatters, but it's hard for me to explain to colleagues trying Clojure that, “yes, 99% of your code will work as-is on ClojureScript but not this one thing format
, yes you have to change all your formats to cl-format or something else to work in both, sorry” 😕
Certainly it makes sense to people who live in JVM and/or JS. To people trying Clojure as a language because I bug them, it appears as an unexpected omission. It's ok tho—I will intimidate them into overlooking the lack of a cljs format (and refer to Google Closure's version, or switch to cl-format)
Prior introducing your colleagues to ClojureScript as a first step you should deeply apologise that there are no threads in JS or that JVM has them 😉 [just kidding]
In fact,
(= (with-out-str (cljs.pprint/pprint very-large-object))
(with-out-str (prn very-large-object)))
Anyone have a clue as to why? Is this true for everyone, or did I screw up some config stuff?
@fasiha: there are libraries like funcool/cuerdas
that already exposes a uniform api for format
for cljs and clj, among other stuff related to strings
@niwinz: thanks! While it looks more generally useful, it looks like cuerdas
' format
does just string interpolation, not %d
and %0.3f
etc.
I'm having a compilation issue with clojurescript 1.9.36
, I'm writing an app that uses untangled and this file https://github.com/untangled-web/untangled-client/blob/f42088c84b059562a48455a71daa6e4ea08d286c/src/untangled/client/data_fetch.cljs fails to compile with Caused by: java.lang.RuntimeException: java.lang.Exception: Not supported: class cljs.tagged_literals.JSValue
this issue doesn't happen with 1.9.14
full error stack:
@wilkerlucio: I ran into a similar issue. Clojurescript moved to JSON format for the analysis cache which errors when serializing incompatible json data
Here is the related jira issue: http://dev.clojure.org/jira/browse/CLJS-1666