This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-04
Channels
- # architecture (5)
- # aws (11)
- # aws-lambda (1)
- # beginners (108)
- # boot (11)
- # cider (37)
- # clara (19)
- # cljsrn (72)
- # clojure (170)
- # clojure-austin (2)
- # clojure-dev (1)
- # clojure-dusseldorf (2)
- # clojure-italy (1)
- # clojure-spec (41)
- # clojure-uk (24)
- # clojurescript (113)
- # component (2)
- # core-async (29)
- # cursive (9)
- # data-science (5)
- # datomic (72)
- # docs (23)
- # duct (61)
- # editors (1)
- # emacs (1)
- # events (5)
- # fulcro (77)
- # graphql (2)
- # hoplon (4)
- # jobs (3)
- # jobs-discuss (16)
- # leiningen (5)
- # off-topic (94)
- # onyx (37)
- # precept (5)
- # re-frame (17)
- # reagent (11)
- # shadow-cljs (18)
- # spacemacs (107)
- # specter (3)
- # unrepl (64)
- # yada (1)
This is causing me some issues on the latest ClojureScript: https://github.com/jeaye/cljs-macro-arity-bug/blob/master/src/test/macro.cljc
I've boiled it down to just those few lines of code; anyone see this before, or am I missing something very silly? That repo is a full repro as well.
In the browser, I see "Invalid arity: 0" but I originally ran into this issue with React Native, where I was seeing "SyntaxError: Return statements are only valid inside functions."
@dnolen Sorry for the confusion. I've updated the repro to better convey the issue I'm seeing, though it doesn't manifest in the same exact error message. It sure does something weird though.
It compiles to this: https://gist.github.com/jeaye/92802a892140738e0916ea8ac13c5b1d
I certainly believe you know cljs far better than me, but why would it cleanly compile?
Furthermore, even if we wrap the defmacro
in a reader conditional, the problem exists (and I've updated the repo to show that).
anyone using cursive see a warning that .querySelector cannot be resolved? been looking all over and can't find much about it.
@bthesorceror That’s possible - accurately resolving JS interop is hard/impossible.
I’ve been meaning to reduce that warning so it’s not so shouty since it can’t really work properly.
Whoops, I just saw you posted this over in #cursive as well, probably better to discuss it over there.
thanks @cfleming just wanted to make sure I wasn't missing something. I always prefer no warnings but understandable.
@bthesorceror Yeah, normally all those warnings are configurable, but that one is not for legacy reasons. I’ll try to fix that shortly.
:thumbsup:
how could I assign a value that comes form destructuring? const {app, Menu, Tray} = require(‘electron’)
@francoleocan there’s no built-in destructuring syntax for host platform data structures
(def electron (nodejs/require "electron"))
(def app (goog.object/get electron "app"))
;; ...
@roman01la Thanks!
@jeaye the issue is a subtle one - it needs to work for bootstrapped ClojureScript, it may be possible to warn in the usual case - but no one has worked on that
your minimal case repo on GitHub makes it challenging to track the problem since you include no description of what you believe to be the defect there especially after your changes
@rauh [:div {:dangerouslySetInnerHTML {:__html "<script>alert('Script runs');</script>"}}]
looks like giving normal html, but allert does not come 😞
not sure what you are trying to do but emitting a :script
via react just isn’t useful
I am trying to put https://github.com/viebel/klipse into here https://github.com/poiga/status-fiddle/blob/some-work-with-clipse/src/cljs/status_fiddle/views.cljs
maybe what you say is good approach, but the first thing came to me fist hiccup all the HTML from examples into the view 🙂
hi all, i'm trying to set up environment variables in my cljs / figwheel project, to avoid commiting API keys to source control - any idea how?
@aconanlai command-line-args https://clojure.org/reference/repl_and_main worked for me
@aconanlai how will I on componentDidMount
execute custom script in the browser? (allert was just a place holder for development)
@dnolen I linked to the generated code, which is quite incorrect, and gave instructions requiring one command to be able to see the error.
To anyone else willing to verify, this looks like a cljs bug to me. https://github.com/jeaye/cljs-macro-arity-bug
@dnolen Ok. I'll approach this a different way. Do you have any idea why cljs would generate code which causes this to be thrown "SyntaxError: Return statements are only valid inside functions."
this is why a description of what you expect and what you got can be more helpful than me running something
They're all of 26 lines total and they all matter, for the reproduction of this issue. I came in here preemptively, to try to save some time in case this was a common error or something (return statements only being valid inside fns from generated clj code). So far, I think it's just been counterproductive for the both of us, so I'll keep trying until I can pinpoint exactly where things are going wrong, so you needn't run anything.
@jeaye the problem I’m having some much trouble is I don’t even understand your example, sorry if we’re talking past each other
Unfortunately, I don't think it's a trivial problem. I'll let you know when I know more.
I'm attempting to reproduce the situation which causes what appears to be an issue with codegen. The actual macros used are far removed from anything practical.
I added those reader conditionals because you wouldn't look beyond me using defmacro
in a cljc.
They're completely unrelated to the problem, as is the initial require
bit you pointed out, but I've been trying to placate you so you can look at the actual issue I'm pointing out.
Is defmacro
within a cljc file which is required from cljs a problem (assuming it's not in a reader conditional)?
but that other macro is in a namespace never actually required by a ClojureScript file
@jeaye I just tested the repo, and the code compiled without any errors/warnings. And it generated (println "foo")
as I would expect by reading the code, am I missing something?
@darwin No, it's me who's missing something. I'm missing an exact repro, so I'll keep hunting.
caching is the devil