This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-09
Channels
- # aleph (1)
- # announcements (7)
- # asami (1)
- # beginners (44)
- # calva (54)
- # cherry (24)
- # cider (6)
- # clj-kondo (19)
- # cljsrn (27)
- # clojure (119)
- # clojure-europe (61)
- # clojure-gamedev (38)
- # clojure-germany (7)
- # clojure-nl (1)
- # clojure-norway (104)
- # clojure-portugal (4)
- # clojure-spec (4)
- # clojure-uk (1)
- # clojurescript (38)
- # cursive (18)
- # datomic (11)
- # emacs (9)
- # events (1)
- # fulcro (4)
- # holy-lambda (7)
- # introduce-yourself (7)
- # jobs (1)
- # malli (6)
- # off-topic (4)
- # pathom (4)
- # pedestal (16)
- # podcasts-discuss (1)
- # polylith (27)
- # portal (17)
- # releases (2)
- # shadow-cljs (46)
- # squint (1)
- # xtdb (9)
EDIT: Will post to GH issues
I have the following do!
macro that wraps individual exprs in js/await
. When I have greater than ~20 expressions in the body of the do!
, the compiler throws an error
(defmacro do!
[& exprs]
`(do
~@(map (fn [expr#] `(js/await ~expr#)) exprs)))
;; usage
(do!
(first-async-fn)
...
(twentieth-async-fn))
file:///Users/alex/code/icebreaker/ui_tests/node_modules/cherry-cljs/lib/cli.js:483
arguments[18],arguments[19],arguments[20],arguments[21]);default:throw Error(["Invalid arity: ",$APP.v.h(arguments.length-1)].join(""));}};$APP.g.apply=function(a,b){return this.call.apply(this,[this].concat($APP.ib(b)))};$APP.g.v=function(){var a=$APP.w(this);return a.v?a.v():a.call(null)};$APP.g.h=function(a){var b=$APP.w(this);return b.h?b.h(a):b.call(null,a)};$APP.g.g=function(a,b){var c=$APP.w(this);return c.g?c.g(a,b):c.call(null,a,b)};
Error: Invalid arity: 23
at VQ.$APP.g.call (file:///Users/alex/code/icebreaker/ui_tests/node_modules/cherry-cljs/lib/cli.js:483:72)
at VQ.$APP.g.apply (file:///Users/alex/code/icebreaker/ui_tests/node_modules/cherry-cljs/lib/cli.js:483:184)
at Xg (file:///Users/alex/code/icebreaker/ui_tests/node_modules/cherry-cljs/lib/cljs_core.js:551:491)
at Wg (file:///Users/alex/code/icebreaker/ui_tests/node_modules/cherry-cljs/lib/cljs_core.js:547:70)
at Ug (file:///Users/alex/code/icebreaker/ui_tests/node_modules/cherry-cljs/lib/cljs_core.js:546:421)
at Function.$APP.Ch.B (file:///Users/alex/code/icebreaker/ui_tests/node_modules/cherry-cljs/lib/cljs_core.js:793:404)
at file:///Users/alex/code/icebreaker/ui_tests/node_modules/cherry-cljs/lib/compiler.js:587:258
at file:///Users/alex/code/icebreaker/ui_tests/node_modules/cherry-cljs/lib/compiler.js:588:267
at $APP.kr.$APP.g.g (file:///Users/alex/code/icebreaker/ui_tests/node_modules/cherry-cljs/lib/compiler.js:213:289)
at file:///Users/alex/code/icebreaker/ui_tests/node_modules/cherry-cljs/lib/compiler.js:185:206
I'm able to work around this issue by wrapping a subset of the expressions (to get under ~20) into their own functions and invoking them i.e.
(do!
(^:async (fn []
(do!
(first-async-fn)
...
(tenth-async-fn)))
(^:async (fn []
(eleventh-async-fn)
...
(twentieth-async-fn)))))
Is =
& other comparators not supported yet?
(= 1 1)
1) [chromium] › cherry_playwright.spec.mjs:422:19 › stage host controls ==========================
ReferenceError: _EQ_ is not defined
> 444 | (await _EQ_.call(null, 1, 1));
I can repro the problem:
$ ./node_cli.js -e '(= 1 2)'
file:///Users/borkdude/dev/cherry/.tmpQ1aZ4r/cherry.mjs:1
_EQ_.call(null, 1, 2);
^
Issue welcome, will fix tonightGotcha. Maybe from the aliases stuff I was doing? I definitely could have messed something up...
No worries :) I don't think it's anything you changed, and even if it was, there should have been a test catching this
@UGGU8TSMC both 78 and 79 are now fixed and published to npm
Thank you! that's interesting re: "EQ" and "=" conflict re: 78, I am still getting the same invalid arity issue after installing alpha59
I've encountered this issue before. The issue is that a function with metadata implements some protocol and protocol implementations can't have more than 20 arguments
but if you unwrap this function, using the .-afn
field, you get the normal function which does support more than 20 args and this is what I've tried. This fix worked in SCI before, but I'll re-test it tomorrow
Here is a repro in cljs:
ClojureScript 1.10.914
cljs.user=> (def f (fn [x & xs]))
#'cljs.user/f
cljs.user=> (apply f (range 30))
nil
cljs.user=> (def f (with-meta (fn f [x & xs]) {}))
#'cljs.user/f
cljs.user=> (apply f (range 30))
Execution error (Error) at (<cljs repl>:1).
Invalid arity: 30