This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-07
Channels
- # announcements (10)
- # babashka (39)
- # beginners (230)
- # calva (16)
- # cider (20)
- # clara (4)
- # cljs-dev (16)
- # clojure (35)
- # clojure-europe (8)
- # clojure-filipino (5)
- # clojure-france (1)
- # clojure-nl (6)
- # clojure-uk (9)
- # clojuredesign-podcast (1)
- # clojurescript (55)
- # clojurewerkz (1)
- # core-async (13)
- # cursive (1)
- # data-science (1)
- # datomic (4)
- # events (1)
- # fulcro (26)
- # jobs-discuss (1)
- # kaocha (3)
- # malli (53)
- # observability (9)
- # off-topic (1)
- # project-updates (1)
- # re-frame (15)
- # reagent (1)
- # reitit (11)
- # rum (8)
- # sci (29)
- # shadow-cljs (7)
- # vim (12)
- # xtdb (13)
hey, i have hit this error after bumping the clojurescript compiler version in my library hasch
: "SEVERE: /home/christian/hasch/resources/private/js/out/incognito/base.js:213: ERROR - [JSC_LANGUAGE_FEATURE] This language feature is only supported for ECMASCRIPT_2018 mode or better: RegExp flag 's'." and was able to solve it by setting :language-in :es-next
, but this will not work for downstream users of my library. any suggestions of how to deal with this issue? i can try to fix the regular expression as well, but it was working fine around 2015-2017.
@whilo probably Google Closure Compiler related changes? If so maybe no good answer for you.
@whilo maybe you can split your RegExp into two parts for the dotAll not being covered https://2ality.com/2017/07/regexp-dotall-flag.html
I'm hoping at devtime to get arg lists from a var in clojurescript. but i see that it doesn't seem to allow specifying arglists on vars whereas clojure does:
tmp ❯❯❯ clj -A:cljs -m cljs.main -re node -r
ClojureScript 1.10.773
cljs.user=> (def ^{:arglists '[[x]]} thing 3)
#'cljs.user/thing
cljs.user=> (:arglists (meta #'thing))
()
cljs.user=> ^D
/tmp ❯❯❯ clj
Clojure 1.10.1
user=> (def ^{:arglists '[[x]]} thing 3)
#'user/thing
user=> (:arglists (meta #'thing))
[[x]]
user=>
was hoping that this might work at dev time even if not under advanced compilation. is this a hopeless ask though?
there's http://cljs.github.io/api/cljs.analyzer.api/resolve which is available at compile time. are you adding new metadata during runtime? I think you could have a macro that "runs" last during compilation to retrieve and store the meta data you care about
(def metadata (grab-all-the-data))
the use case is our components library has a core namespace which exposes all the components and want to get the arglists for them all on these versions so its
(def button lib/button)
so it would get pretty tedious to do all of that. Also tooling needs the arglists on the var and not something similar to the var
I think you could write a macro that does that
yeah. but it would emit what i'm doing here with explicit meta. and that meta doesn't seem to be respected
so ironically this inline stuff is picked up by the static tooling but not by the repl so nrepl can't display it
you would have to retrieve the meta-data using cljs.analyzer.api/resolve
so is it unreasonable to expect (def ^{:arglists '[[x]]} thing 3)
to set the arglists metadata?
afaik, it only gets set on the thing
var, which is only available at compile time through cljs.analyzer.api/resolve
further, depending on how you build your cljs, the var metadata isn't persisted if you have a tool that doesn't do full recompiles for each build. eg. if you run lein cljsbuild once
and then lein cljsbuild once
again. multiple builds lein cljsbuild auto
is fine if you clean before building.
ljs.user=> (def ^{:arglists '[[x]]} thing 3)
#'cljs.user/thing
cljs.user=> (meta #'thing)
{:ns cljs.user, :name thing, :file "<cljs repl>", :end-column 31, :source "^{:arglists '[[x]]} thing", :column 1, :line 1, :end-line 1, :arglists (), :doc nil, :test nil}
cljs.user=>
@U4YGF4NGM i'm also confused. just not sure if this is expected or not due to the unique nature of "vars" in cljs
good test.
cljs.user=> (def ^{:foo '[[x]]} thing 3)
#'cljs.user/thing
cljs.user=> (:foo (meta #'thing))
(quote [[x]])
cljs.user=>
yeah. gonna raise a question on http://ask.clojure.org to see what others think
https://ask.clojure.org/index.php/9526/should-cljs-respect-arglists-metadata-on-defd-vars
thanks. i can raise a ticket in jira. but there's also a http://ask.clojure.org page if that's easier to convert to jira
After upgrading ClojureScript from 1.10.597
` to 1.10.773
, es6 stuff like "let" and "const" appear in the compiled js.
Is this because of the closure compiler bump? It causes problems in for example IE11.
How about this? https://clojurescript.org/reference/compiler-options#language-in-and-language-out
Haven't tried, but I assume setting :language-out to a lower version would do it for you
I keep on forgetting how to conditionally distinguish between regular cljs and self-hosted cljs, so I distilled what I did for rewrite-cljc https://github.com/lread/demo-clj-variants. I’m no expert, so there is a chance I’m out to lunch. Feedback and corrections are most welcome. If this is already well documented elsewhere I am happy to delete my little repo.