This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-25
Channels
- # adventofcode (1)
- # announcements (1)
- # beginners (244)
- # calva (20)
- # cider (11)
- # cljs-dev (34)
- # clojure (50)
- # clojure-spec (1)
- # clojure-uk (3)
- # clojurebridge (1)
- # clojurescript (21)
- # code-reviews (1)
- # cursive (19)
- # events (1)
- # expound (1)
- # fulcro (65)
- # hyperfiddle (6)
- # luminus (3)
- # nrepl (3)
- # off-topic (23)
- # protorepl (4)
- # re-frame (18)
- # rum (11)
- # shadow-cljs (77)
- # spacemacs (8)
- # tools-deps (2)
- # unrepl (1)
- # vim (2)
Wait... so if you use that to, for example look at [goog string trim]
, you get {:tag Function, :ret-tag string}
, which seems to imply we ultimately have a way to infer the return type of clojure.string/trim
as string
(and if that existed, no need to manually hint as in https://dev.clojure.org/jira/browse/CLJS-2868)
I have a macro that expands to a call to react/createElement
using (:require [react])
via :global-exports
. Users of this macro would need to require react
in the calling namespace; to make this easier to use, I alias createElement in a cljs namespace of the same name as the macro namespace (def createElement react/createElement)
; then the macro can expand to (my-ns/createElement ...)
instead
e.g. x.cljs$core$IFn$_invoke$arity$2 ? x.cljs$core$IFn$_invoke$arity$2.call(...) : x.call(...)
I thought of making a fn wrapper instead so that cljs would see the type correctly, but unfortunately I sometimes need to call with var-args
@favila there's really no way to avoid that with ClojureScript fns, but I don't really see how this could be much of a problem
it seems a strange asymmetry. If a symbol is known to be js, it emits a direct invocation (no .call
even); but if you alias it in cljs-land, it's impossible to get that back?
so this isn't operating at the type level, it's the "namespace" of the symbol that determines the invocation style
IMHO there should be a typehint or something that has the same effect but I don't think there is
I have a dumb question. is there a way to differentiate between a CLJS function and a JS function? e.g. one defined via defn
vs an external JS lib
if it's multi-arity there will be some extra properties on it; all bets are off in advanced compile of course
FWIW I think a 10% overhead at runtime for something that gets called as often as React.createElement
is quite expensive and probably worth optimizing
Is there a JIRA ticket tracking the CLJS equivalent to https://dev.clojure.org/jira/browse/CLJ-2373? It has come to my attention that https://github.com/clojure/clojurescript/commit/5f0fabc65ae7ba201b32cc513a1e5931a80a2bf7 makes CLJS spec errors like CLJ (which is great to have parity!) but I don’t believe CLJS yet has an equivalent of this code https://github.com/clojure/clojure/blob/b182982007df934394f0bc68b3a238ca9f200dd1/src/clj/clojure/main.clj#L268-L279
as as result, I believe users can no longer install a custom spec reporting e.g. expound in CLJS 1.10.439 https://gist.github.com/bhb/6bd51f798f9eaa50850fb18c44aaa733