> we’ve switched back from String- to String syntax for class array literals I'm curious about the decision matrix behind this change...
Not curious, thank God!
If you're not interested in the topic, there's no need to make a comment -- especially a snarky one like this.
Sorry, I shouldn't have been that snarky. In my opinion, the previous naming convention was ugly.
in essence, the slightly increased overlap with existing cases was deemed to be less of an issue than not liking the "-"
Thanks, @alexmiller
Is String* "just" syntax or will it exist as a symbol in clojure.core?
syntax
we couldn't add array class symbol mappings for all classes in the universe so....
OK, so if there is a "conflict" with a namespace symbol that matches, you can't use the syntax without renaming your namespace symbol?
correct (or you can do what you do now)
Got it. Thanks.
that universe of overlap was deemed to be small enough
note that there is no conflict for use as type hints, this is only an issue when resolving a class array symbol as a value
so you can always use it as a type hint
Looking forward to trying it out in Alpha 6 🙂
looking forward to having an alpha 6 :)
> note that there is no conflict for use as type hints, this is only an issue when resolving a class array symbol as a value what would be an example of doing this?
doing which - type hint or value?
> only an issue when resolving a class array symbol as a value I assume "as a value"...
same as any case where you would currently use a ClassName as a value
using as an instance? check, extending as a protocol, switching a multimethod, etc
into-array potentially too?
seems unlikely, but sure
Ah ok. I see now.
if anyone is interested, I have been working on doc updates for Clojure 1.12 in a site branch https://github.com/clojure/clojure-site/compare/master...1.12-doc-updates#files_bucket - this has not been reviewed yet but should be mostly up to date
The new syntax is great for auto-completion by static analysis (kondo+lsp). It (imo) begs the question if class aliases would become desirable since class names are going to be repeated a lot with this new syntax. E.g.:
(ns foo (:import [java.io.File :as F]))
(F/exists "README.md")
Not doing that
well ok, even less work for static analysis then, thanks ;)
functional interface coercion is still a TODO
these are good changes, thanks for the link
> These functions are available in the tools.deps.repl namespace:
That should be clojure.repl.deps (line 169 of repl_and_main.adoc).
Where this block was updated, the last two items were removed -- is that because (Classname/method args*) is "core" syntax now and not expanded to a . form (and covers both static and instance method invocation)?
(.instanceMember instance args*) ==> (. instance instanceMember args*)
(.instanceMember Classname args*) ==> (. (identity Classname) instanceMember args*)
(.-instanceField instance) ==> (. instance -instanceField)
(Classname/staticMethod args*) ==> (. Classname staticMethod args*) ; removed
Classname/staticField ==> (. Classname staticField) ; removed
the last one was removed because it is a lie - that has never happened :)
and the 2nd to last has been removed because that is part of the implementation - we are going to stop macroexpanding the Class/member to dot form
the dot form still exists, will still work, etc but we're going to instead understand Class/method directly in the compiler now. in function position this will ultimately create the identical expressions it creates now but the path will be a bit different. in value position, this will create a new expression that emits as a thunk.
lots of implementation choices in this area
Nice simplification (for us users, not so much for you implementors!).
it actually is much simpler than what we were doing in the implementation too
macroexpansion will do less so we're removing code there, and we no longer need anything in syntax quote resolution, and we get rid of all the symbol string parsing
the analyzer is the only tricky bit