This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-24
Channels
- # announcements (6)
- # beginners (89)
- # calva (75)
- # cider (37)
- # clj-kondo (1)
- # cljs-dev (19)
- # cljsjs (8)
- # clojars (1)
- # clojure (122)
- # clojure-europe (6)
- # clojure-italy (41)
- # clojure-nl (18)
- # clojure-uk (24)
- # clojurescript (26)
- # cursive (6)
- # data-science (5)
- # datomic (51)
- # emacs (28)
- # fulcro (8)
- # graalvm (13)
- # hoplon (1)
- # immutant (1)
- # jobs (3)
- # joker (1)
- # keechma (43)
- # lambdaisland (1)
- # leiningen (37)
- # midje (1)
- # nrepl (2)
- # off-topic (32)
- # re-frame (3)
- # reagent (24)
- # reitit (5)
- # remote-jobs (1)
- # shadow-cljs (33)
- # sql (7)
- # tools-deps (11)
@john it should be possible to detect that kind of trivial case - but in general there are no surprises here
it's been that way for 8 years and has no real impact on portability of code far as I can tell
do anything at runtime would require argument introspection and that's a JS VM perf hole - so not going to do that
Thats what I figured. Thanks @dnolen FWIW, I think I prefer ClojureScript's more permissive version.
@john FWIW, your program is incorrect. (ClojureScript is not intentionally being permissive.)
For example, if we discovered a way to add arity checks at runtime without a perf penalty, then such broken programs would—well—break.
The only thing that worries me is that devs might start passing in extra args to anonymous fns with the expectation that, in the future, they may want to expand their API to handle those extra args, but drop them silently until then. That code would break if stricter arity checking were enforced
yeah our codebase definitely has laziness about e.g. zero-arg inline fns for event handlers (they should have one unused event arg)
The analyzer could be improved to emit arity diagnostics for immediately invoked anonymous functions
It could probably also catch, in general, arity issues with immediately invoked expressions
@john for portable code you won't do that ... because it's not portable and it will be come readily apparent
I haven't seen the case you're talking about personally - most of the cases I've seen are cases of code cleanliness