This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-07-15
Channels
- # aleph (8)
- # architecture (8)
- # babashka (26)
- # beginners (20)
- # calva (14)
- # clojure (6)
- # clojure-dev (28)
- # clojure-europe (39)
- # clojure-france (2)
- # clojure-korea (3)
- # clojure-losangeles (2)
- # clojure-nl (2)
- # clojure-norway (9)
- # clojure-uk (7)
- # clojurescript (10)
- # clr (1)
- # cursive (22)
- # data-science (19)
- # datomic (16)
- # jobs-discuss (2)
- # leiningen (3)
- # off-topic (10)
- # polylith (4)
- # reitit (2)
- # releases (1)
- # ring (10)
- # uncomplicate (1)
- # xtdb (6)
is it possible to remove locked Asks from the "Highest Votes" page? I can do it mentally myself, but it would be nice to have it automated too. https://ask.clojure.org/index.php/questions/clojure?sort=votes
We actually have a thing to make a sheet for better review, and could make the output public somewhere
that's great to hear
I think this should be visible, it's recent-ish: https://docs.google.com/spreadsheets/d/1hrVyO-a9l_9ea3CXOfQPa8mMlShHRaeBJi1WUYmlSds/edit?usp=sharing
hell yeah, thanks.
no jira for "find-first" lmao
there was a jira for that, and it was already declined, but I have left it open to ask Rich again
oops, missed that.
what is the purpose of both invoke
and invokeStatic
for compiled classes of functions? Why can't there just be a single invoke
that does the thing?
Invoke-static is for direct linking
when is invoke
not a direct call into invokeStatic
?
Call sites with dl make a direct static method invocation without going through the var
Var calls look up the var, get the function object and invoke
Let me know if that did not resolve your question
i'm speaking mostly from ignorance because i don't know jvm asm and don't quite know how the compiler works, i only have looked at the clj-decompiler output and read stack traces, but it seems to me that whatever is passed to invoke
is going to be passed to invokeStatic
, so in both cases, they're doing the same thing
when i write (foo 100)
, there's a var lookup (to handle bindings, etc) of foo
. but that's still a call to (Var.lookup(new Symbol(null, "foo"))).invoke(100)
or something, right? why not just generate (Var.lookup(new Symbol(null, "foo")).invokeStatic(100)
?
The invoke has existed since the beginning so one answer is backwards compatibility
I think invoke is also used in hof call regardless?
In hof you are passing an instance with possibly closed over Val’s and you need to invoke through the object, not statically (statics can use the instance closed over values)
You can’t always make the static call
invokeStatic is a java static method, so no instance data (can't close over anything)
so obviously not suitable for the general case of representing invoking functions (which can close over data)
the static call is nice because it doesn't require creating an instance of the function? aka you don't have to write Object foo = new example.core$foo(); return foo.invoke()
, you can just write return example.core$foo.invokeStatic();
or something
i guess the complexity of juggling static invocations vs instance invocations is worthwhile for performance?
when you can make the static call (and avoid the synchronization point of the var lookup), it is a substantial win
in general, static calls are ideal for inlining (both from external use or invoke -> invokeStatic)
cool, thanks for the explanations