clojure-dev

2024-07-15T15:49:57.989149Z

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

Alex Miller (Clojure team) 2024-07-15T16:26:43.247259Z

We actually have a thing to make a sheet for better review, and could make the output public somewhere

2024-07-15T17:35:59.847209Z

that's great to hear

Alex Miller (Clojure team) 2024-07-15T17:50:44.473569Z

I think this should be visible, it's recent-ish: https://docs.google.com/spreadsheets/d/1hrVyO-a9l_9ea3CXOfQPa8mMlShHRaeBJi1WUYmlSds/edit?usp=sharing

πŸ‘ 1
2024-07-15T17:51:18.611849Z

hell yeah, thanks.

2024-07-15T17:51:55.220189Z

no jira for "find-first" lmao

Alex Miller (Clojure team) 2024-07-15T17:53:38.319869Z

see the READ ME tab, jira stuff is scraped, may be incomplete

πŸ‘ 1
Alex Miller (Clojure team) 2024-07-15T17:54:02.039559Z

there was a jira for that, and it was already declined, but I have left it open to ask Rich again

2024-07-15T17:56:47.524069Z

oops, missed that.

2024-07-15T18:26:54.618599Z

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?

2024-07-16T14:52:49.358209Z

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

2024-07-16T14:53:34.853449Z

i guess the complexity of juggling static invocations vs instance invocations is worthwhile for performance?

Alex Miller (Clojure team) 2024-07-16T15:01:24.346589Z

when you can make the static call (and avoid the synchronization point of the var lookup), it is a substantial win

πŸ‘ 1
Alex Miller (Clojure team) 2024-07-16T15:02:18.479769Z

in general, static calls are ideal for inlining (both from external use or invoke -> invokeStatic)

πŸ‘ 1
2024-07-16T15:40:28.026559Z

cool, thanks for the explanations

Alex Miller (Clojure team) 2024-07-15T18:27:50.476289Z

Invoke-static is for direct linking

2024-07-15T18:28:23.462509Z

when is invoke not a direct call into invokeStatic?

Alex Miller (Clojure team) 2024-07-15T18:28:28.303029Z

Call sites with dl make a direct static method invocation without going through the var

Alex Miller (Clojure team) 2024-07-15T18:29:07.836989Z

Var calls look up the var, get the function object and invoke

Alex Miller (Clojure team) 2024-07-15T18:30:33.311009Z

Let me know if that did not resolve your question

2024-07-15T18:40:00.485969Z

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

2024-07-15T18:42:59.465679Z

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)?

Alex Miller (Clojure team) 2024-07-15T18:48:19.892999Z

The invoke has existed since the beginning so one answer is backwards compatibility

Alex Miller (Clojure team) 2024-07-15T18:49:44.142519Z

I think invoke is also used in hof call regardless?

Alex Miller (Clojure team) 2024-07-15T18:51:10.992919Z

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)

Alex Miller (Clojure team) 2024-07-15T18:51:57.194009Z

You can’t always make the static call

2024-07-15T18:52:02.130249Z

invokeStatic is a java static method, so no instance data (can't close over anything)

2024-07-15T18:54:19.595639Z

so obviously not suitable for the general case of representing invoking functions (which can close over data)