You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/news/2024/09/05/clojure-1-12-0.adoc
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ Updated dependencies:
43
43
44
44
There are many development-time cases where it would be useful to add a library interactively without restarting the JVM - speculative evaluation, adding a known dependency to your project, or adding a library to accomplish a specific task.
45
45
46
-
Clojure now provides <<xref/../../../repl_and_main#add_lib,new functions to add libraries interactively>>, without restarting the JVM or losing the state of your work:
46
+
Clojure now provides <<xref/../../../../../reference/repl_and_main#add_lib,new functions to add libraries interactively>>, without restarting the JVM or losing the state of your work:
47
47
48
48
* https://clojure.github.io/clojure/branch-master/clojure.repl-api.html#clojure.repl.deps/add-lib[add-lib] takes a lib that is not available on the classpath, and makes it available by downloading (if necessary) and adding to the classloader. Libs already on the classpath are not updated. If the coordinate is not provided, the newest Maven or git (if the library has an inferred git repo name) version or tag are used.
49
49
* https://clojure.github.io/clojure/branch-master/clojure.repl-api.html#clojure.repl.deps/add-libs[add-libs] is like `add-lib`, but resolves a set of new libraries and versions together.
@@ -74,7 +74,7 @@ For a long time, we've had the `clojure.java.shell` namespace, but over time Jav
74
74
75
75
Clojure programmers often want to use Java methods in higher-order functions (e.g. passing a Java method to `map`). Until now, programmers have had to manually wrap methods in functions. This is verbose, and might require manual hinting for overload disambiguation, or incur incidental reflection or boxing.
76
76
77
-
Programmers can now use <<clojure-1-12-0#qualified_methods,qualified methods>> as ordinary functions in value contexts - the compiler will <<xref/../../../reference/java_interop#methodvalues,automatically generate the wrapping function>>. The compiler will generate a reflective call when a qualified method does not resolve due to overloading. Developers can supply <<clojure-1-12-0#param_tags,`:param-tags`>> metadata on qualified methods to specify the signature of a single desired method, 'resolving' it.
77
+
Programmers can now use <<clojure-1-12-0#qualified_methods,qualified methods>> as ordinary functions in value contexts - the compiler will <<xref/../../../../../reference/java_interop#methodvalues,automatically generate the wrapping function>>. The compiler will generate a reflective call when a qualified method does not resolve due to overloading. Developers can supply <<clojure-1-12-0#param_tags,`:param-tags`>> metadata on qualified methods to specify the signature of a single desired method, 'resolving' it.
78
78
79
79
[[qualified_methods]]
80
80
### 2.5 Qualified methods - `Class/method`, `Class/.method`, and `Class/new`
@@ -98,23 +98,23 @@ Note: Static fields are values and should be referenced without parens unless th
98
98
99
99
When used as values, qualified methods supply only the class and method name, and thus cannot resolve overloaded methods.
100
100
101
-
Developers can supply <<xref/../../../reference/java_interop#paramtags,`:param-tags`>> metadata on qualified methods to specify the signature of a single desired method, 'resolving' it. The `:param-tags` metadata is a vector of zero or more tags: `[tag ...]`. A tag is any existing valid `:tag` metadata value. Each tag corresponds to a parameter in the desired signature (arity should match the number of tags). Parameters with non-overloaded types can use the placeholder `_` in lieu of the tag. When you supply :param-tags metadata on a qualified method, the metadata must allow the compiler to resolve it to a single method at compile time.
101
+
Developers can supply <<xref/../../../../../reference/java_interop#paramtags,`:param-tags`>> metadata on qualified methods to specify the signature of a single desired method, 'resolving' it. The `:param-tags` metadata is a vector of zero or more tags: `[tag ...]`. A tag is any existing valid `:tag` metadata value. Each tag corresponds to a parameter in the desired signature (arity should match the number of tags). Parameters with non-overloaded types can use the placeholder `_` in lieu of the tag. When you supply :param-tags metadata on a qualified method, the metadata must allow the compiler to resolve it to a single method at compile time.
102
102
103
103
A new metadata reader syntax `^[tag ...]` attaches `:param-tags` metadata to member symbols, just as `^tag` attaches `:tag` metadata to a symbol.
104
104
105
105
### 2.7 Array class syntax
106
106
107
107
Clojure supports symbols naming classes both as a value (for class object) and as a type hint, but has not provided syntax for array classes other than strings.
108
108
109
-
Developers can now refer to an <<xref/../../../reference/java_interop#_class_access,array class>> using a symbol of the form `ComponentClass/#dimensions`, eg `String/2` refers to the class of a 2 dimensional array of Strings. Component classes can be fully-qualified classes, imported classes, or primitives. Array class syntax can be used as both type hints and values.
109
+
Developers can now refer to an <<xref/../../../../../reference/java_interop#_class_access,array class>> using a symbol of the form `ComponentClass/#dimensions`, eg `String/2` refers to the class of a 2 dimensional array of Strings. Component classes can be fully-qualified classes, imported classes, or primitives. Array class syntax can be used as both type hints and values.
Java programs emulate functions with Java functional interfaces (marked with the https://docs.oracle.com/javase/8/docs/api/java/lang/FunctionalInterface.html[@FunctionalInterface] annotation), which have a single method.
116
116
117
-
Clojure developers can now invoke Java methods taking <<xref/../../../reference/java_interop#functional_interfaces,functional interfaces>> by passing functions with matching arity. The Clojure compiler implicitly converts Clojure functions to the required functional interface by constructing a lambda adapter. You can explicitly coerce a Clojure function to a functional interface by hinting the binding name in a `let` binding, e.g. to avoid repeated adapter construction in a loop, e.g. `(let [^java.util.function.Predicate p even?] ...)`.
117
+
Clojure developers can now invoke Java methods taking <<xref/../../../../../reference/java_interop#functional_interfaces,functional interfaces>> by passing functions with matching arity. The Clojure compiler implicitly converts Clojure functions to the required functional interface by constructing a lambda adapter. You can explicitly coerce a Clojure function to a functional interface by hinting the binding name in a `let` binding, e.g. to avoid repeated adapter construction in a loop, e.g. `(let [^java.util.function.Predicate p even?] ...)`.
118
118
119
119
### 2.9 Java Supplier interop
120
120
@@ -124,7 +124,7 @@ Calling methods that take a https://docs.oracle.com/javase/8/docs/api/java/util/
124
124
125
125
Java APIs increasingly return https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html[Stream]s and are hard to consume because they do not implement interfaces that Clojure already supports, and hard to interop with because Clojure doesn't directly implement Java functional interfaces.
126
126
127
-
In addition to functional interface support, Clojure <<xref/../../../reference/java_interop#streams,now provides these functions>> to interoperate with streams in an idiomatic manner, all functions behave analogously to their Clojure counterparts:
127
+
In addition to functional interface support, Clojure <<xref/../../../../../reference/java_interop#streams,now provides these functions>> to interoperate with streams in an idiomatic manner, all functions behave analogously to their Clojure counterparts:
0 commit comments