Replies: 3 comments
-
I think this looks promising. I wonder if we could inline the different arities too, since I doubt we would generate code that would directly invoke each arity method. |
Beta Was this translation helpful? Give feedback.
-
I created two varargs functions here: https://github.com/clavascript/clava-immer/blob/main/index.cljs which gives this (horribly long) output: https://github.com/clavascript/clava-immer/blob/main/index.mjs It would be a nice goal to reduce that output. |
Beta Was this translation helpful? Give feedback.
-
Converted to discussion. I'm open to reducing boilerplate as long as compatibility with CLJS is preserved and it keeps working with |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When skipping an arity
The following function does not have an arity 2
In Clojure
ClojureScript also behaves the same
In Clava
An Error was expected but instead vararg variant is invoked.
We do get an error if vararg is not there.
Vararg performance
Consider the following example
Following is part of the code which is generated
the problometic part is the default case in the switch statement.
Using the new es6 spread feature the variadic function could be rewritten as
the diffrence is the
...
before theargs
then the default case in the switch could be rewriten as
also
f44["cljs$lang$applyTo"]
could be simplified in a similarly.Beta Was this translation helpful? Give feedback.
All reactions