This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-02
Channels
- # beginners (26)
- # bitcoin (1)
- # boot (9)
- # boot-dev (5)
- # cider (26)
- # cljs-dev (1)
- # clojure (190)
- # clojure-finland (1)
- # clojure-italy (42)
- # clojure-nl (20)
- # clojure-russia (3)
- # clojure-sanfrancisco (1)
- # clojure-serbia (1)
- # clojure-spec (50)
- # clojure-uk (16)
- # clojurescript (62)
- # core-async (4)
- # cryogen (1)
- # cursive (6)
- # datascript (1)
- # datomic (36)
- # duct (6)
- # editors (6)
- # emacs (14)
- # graphql (3)
- # leiningen (30)
- # off-topic (21)
- # om (7)
- # parinfer (13)
- # portkey (56)
- # re-frame (2)
- # reagent (2)
- # shadow-cljs (58)
- # vim (1)
- # yada (3)
@thheller Right now the clojurescript porting comes at a heavy cost: most of the debugger help is lost, even for non-ported code. Very often the variables view is empty, and the debugger complaints about missing scopes. Is it something I have configured incorrectly, you think?
Hi all, I’m having trouble calling cljs’s “format” function.
(format "%d bottles of beers on the wall" 99)
=> TypeError: Cannot read property 'call' of undefined
at eval (eval at <anonymous> (), <anonymous>:1:23)
I have no idea how to go about figure out what I’m doing wrong here. I’m using shadow-cljs version 2.3.16.@mjmeintjes no idea. are you deleting the .shadow-cljs
for any reason? or using :cache-root "target/shadow-cljs"
and deleting the target
dir (lein does this)? or any other classloader/classpath trickery?
@doglooksgood no. cache is always per build. shared would be invalidated far too often to be useful.
@odie yeah format
doesn't exist. there is goog.string.format
but it requires a weird require setup (:require [goog.string.format] [goog.string :refer (format)])
I can step the code and such, but there's an exception thrown complaining about scopes
something.
In that the code looks sane and I can step it, yes. At least the code that was .js
. Stepping the cljs
code does not work very well.
Exactly. I have to put the breakpoint in the compiled JS, but code picks up the source JS when the breakpoint fires.
It gets a bit crazy since the compiled JS is quite heavily rewwritten, but I think I can live with that. The problem is this lack of context such as variables, which I think is due to that exception on lacking scopes
.
It just happens. Code opens up the source when the code pointer enters the compiled code (not sure I am using the right terminology):
sorry I have never used the vscode debugger and do not quite understand what you are doing
Here's part of that stack trace I mentioned:
Error processing "scopes": TypeError: Line must be greater than or equal to 1, got -1
at BasicSourceMapConsumer.SourceMapConsumer_findMapping [as _findMapping] (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.node-debug2/node_modules/vscode-chrome-debug-core/node_modules/source-map/lib/source-map-consumer.js:584:13)
What I do is that I place a breakpoint in the generated code. When that breakpoint hits, Code opens up the source and I can step the code without pretending to be a closure compiler. Sometimes I can see some variables , but most often not (and that exception is thrown).
yeah sorry I won't be much help here. not enough time/brain capacity to look into how vscode works
so no idea why vscode complains. might be something incorrect in the source map but I don't know
I'll investigate it further and see if I can understand if something can be fixed on our (as in shadow-cljs or Calva) end.
@thheller Quick question before I open an issue with the Closure compiler, since you've worked a lot with externs - are you aware of any way to add Closure annotations to internal code with externs or something? I tried using externs directly, but as expected they get overridden by the annotation-less actual function definition:
variable cljs.core.inc redefined with type function(?): ?, original definition at EXTERNS:externs/clojure.core.js:12 with type function(number): number
Yeah I get the idea, I'm just trying to make this work somehow. Will open an issue with Closure, then. Thank you
Among other things. Working on something and went off on a bit of a tangent to see how well this might work.
typing clojure maps and vectors is pretty hard and I think you'd need new stuff the GCC doesn't support for it
ie. how do you type [:div {:foo "bar"} "hello world"]
when it also may be [:div "hello world"]
and so on
Oh I'm not expecting any sort of deep structural typing from this, it's just some added value to a library that I'm trying to get over the finish line.
There's lots of runtime exceptions that boil down to trying to pass a vector where you should have passed a map or something.
I wouldn't put too much effort into this. CLJS doesn't typecheck at all anyways the check
is sort of a failed experiment in that regard
it is useful in certain situations but you'll never get it to actually fully typecheck a program