Fork me on GitHub
#clojurescript
<
2020-08-07
>
whilo08:08:45

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.

Franklin09:08:36

Does anyone know any good table libraries to use with re-frame?

dnolen12:08:05

@whilo probably Google Closure Compiler related changes? If so maybe no good answer for you.

sova-soars-the-sora13:08:34

@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

dpsutton16:08:13

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:

dpsutton16:08:16

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=>

dpsutton16:08:54

was hoping that this might work at dev time even if not under advanced compilation. is this a hopeless ask though?

phronmophobic16:08:10

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

dpsutton16:08:38

at deftime as in the example

dpsutton16:08:42

i suppose compile time

phronmophobic16:08:49

(def metadata (grab-all-the-data))

dpsutton16:08:37

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

phronmophobic16:08:25

I think you could write a macro that does that

dpsutton16:08:51

yeah. but it would emit what i'm doing here with explicit meta. and that meta doesn't seem to be respected

dpsutton16:08:04

also, it needs to be static for the clojure-lsp peeps

dpsutton16:08:27

so ironically this inline stuff is picked up by the static tooling but not by the repl so nrepl can't display it

phronmophobic16:08:42

you would have to retrieve the meta-data using cljs.analyzer.api/resolve

dpsutton16:08:09

so is it unreasonable to expect (def ^{:arglists '[[x]]} thing 3) to set the arglists metadata?

phronmophobic16:08:51

afaik, it only gets set on the thing var, which is only available at compile time through cljs.analyzer.api/resolve

lilactown16:08:59

@dpsutton that should work so I am surprised

phronmophobic16:08:02

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.

lilactown16:08:13

#'thing should expand to include metadata on the var

dpsutton16:08:21

yes it does. all expect the arglists

dpsutton16:08:40

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=>

dpsutton16:08:54

its in the source but not in the arglists meta

lilactown16:08:14

can you real quick try something other than :arglists?

dpsutton16:08:25

@U4YGF4NGM i'm also confused. just not sure if this is expected or not due to the unique nature of "vars" in cljs

dpsutton16:08:13

good test.

cljs.user=> (def ^{:foo '[[x]]} thing 3)
#'cljs.user/thing
cljs.user=> (:foo (meta #'thing))
(quote [[x]])
cljs.user=>

lilactown16:08:49

my guess is that :arglists is special cased in the compiler 😕

dpsutton16:08:05

yeah. gonna raise a question on http://ask.clojure.org to see what others think

dpsutton16:08:15

i don't know enough to know if this is expected or a bug

lilactown16:08:49

I expect it’s a bug 😄 maybe not a high priority one tho

dnolen17:08:29

I'm assuming you tried this w/ core fns and that stuff isn't missing

dpsutton17:08:41

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

dpsutton17:08:51

yeah. arglists are present on (meta #'inc)

dnolen17:08:00

just do JIRA directly if you can w/ something minimal

dpsutton17:08:05

seems to get clobbered on its journey

dpsutton17:08:08

can do. thanks

dpsutton17:08:59

priority minor?

dnolen17:08:37

yeah

👍 3
curlyfry19:08:19

After upgrading ClojureScript from 1.10.597` to 1.10.773, es6 stuff like "let" and "const" appear in the compiled js.

curlyfry19:08:31

Is this because of the closure compiler bump? It causes problems in for example IE11.

curlyfry19:08:38

And is there a way to avoid it?

isak19:08:55

Haven't tried, but I assume setting :language-out to a lower version would do it for you

curlyfry19:08:45

Thank you! Will try it out.

curlyfry19:08:32

Looks like it worked :thumbsup:

3
lread21:08:41

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.

👍 3