From a3fa740a0abdd23935fdd27cede592d75f977a24 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Tue, 2 Jan 2024 17:36:32 -0600 Subject: [PATCH] update symbol resolution on evaluation page --- content/reference/evaluation.adoc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/content/reference/evaluation.adoc b/content/reference/evaluation.adoc index 3bea30ff..c4b6c626 100644 --- a/content/reference/evaluation.adoc +++ b/content/reference/evaluation.adoc @@ -24,12 +24,16 @@ Strings, numbers, characters, `true`, `false`, `nil` and keywords evaluate to th A Symbol is _resolved_: -* If it is namespace-qualified, the value is the value of the binding of the global var named by the symbol. It is an error if there is no global var named by the symbol, or if the reference is to a non-public var in a different namespace. -* If it is package-qualified, the value is the Java class named by the symbol. It is an error if there is no Class named by the symbol. +* If it is namespace-qualified: +. If the symbol names a global public var, the value is the value of the binding of that var. +. Since Clojure 1.12, if the namespace is package-qualified or resolves to a class in the current namespace, and the symbol name is a static member, the value is a Clojure function that invokes the static member. +. Since Clojure 1.12, if the namespace starts with `.` and is a package-qualified class name, the value is a Clojure function that invokes an instance method. +. Else it is an error. +* If it is package-qualified, the value is the Java class named by the symbol. It is an error if there is no Class named by the symbol. Since Clojure 1.12, a class name or primitive name ending with one or more `pass:[*]`s resolves to an array class. * Else, it is not qualified and the first of the following applies: . If it names a special form it is considered a special form, and must be utilized accordingly. . If in a local scope (e.g. in a function definition or a let form), a lookup is done to see if it names a local binding (e.g. a function argument or let-bound name). If so, the value is the value of the local binding. -. A lookup is done in the current namespace to see if there is a mapping from the symbol to a class. If so, the symbol is considered to name a Java class object. Note that class names normally denote class objects, but are treated specially in certain special forms, e.g. `.` and `new`. +. A lookup is done in the current namespace to see if there is a mapping from the symbol to a class. If so, the symbol is considered to name a Java class object. Note that class names normally denote class objects, but are treated specially in certain special forms, e.g. `.` and `new`. Since Clojure 1.12, a class name or primitive name ending with one or more `pass:[*]`s resolves to an array class. . A lookup is done in the current namespace to see if there is a mapping from the symbol to a var. If so, the value is the value of the binding of the var referred-to by the symbol. . It is an error.