Skip to content

Commit

Permalink
undoing some of the eval changes
Browse files Browse the repository at this point in the history
  • Loading branch information
puredanger committed Aug 28, 2024
1 parent cdff969 commit f9acfff
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions content/reference/evaluation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,19 @@ 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 the qualifier names a class or a mapping from symbol to class in the current namespace or a primitive name, and the symbol name is:
* 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 the qualifier names a class, and the name is:
** a static field in the class, then the value is the value of the static field.
** a static method of the class, then the value is a Clojure function that invokes the static method.
** a `.` prefixing an instance method of the class, then the value is a Clojure function that invokes the instance method (since 1.12).
** `new`, then the value is a Clojure function that invokes the constructor (since 1.12).
** `1`-`9`, then the value is the array class whose component type is the qualifier and dimension per the digit (since 1.12).
** a static method of the class, then the value is a Clojure function that invokes the static method. (since 1.12)
** a `.` prefixing an instance method of the class, then the value is a Clojure function that invokes the instance method. (since 1.12)
** `new`, then the value is a Clojure function that invokes the constructor. (since 1.12)
* If the qualifier names a class, and the symbol name is:
** `1`-`9`, then the value is the array class whose component type is the qualifier and dimension per the digit. (since 1.12)
* Else, it is not qualified and the first of the following applies to the symbol name:
. 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 var. If so, the value is the value of the binding of the var referred-to by the symbol.
. If it names a class or a mapping from symbol to class in the current namespace, the value is the Java class named by the symbol.
. It is an error.
If a Symbol has metadata, it may be used by the compiler, but will not be part of the resulting value.
Expand Down

0 comments on commit f9acfff

Please sign in to comment.