1

I was browsing the clojure source code this morning, and near the top of clojure/core.clj I found this:

(def
    ^{:arglists '([& items])
      :doc "Creates a new list containing the items."
      :added "1.0"}
    list (. clojure.lang.PersistentList creator))

The thing that looks odd to me is the symbol creator. It doesn't appear anywhere in the file above it. Why is that not a problem?

1 Answer 1

6

The dot special form is used for java interop. Since clojure.lang.PersistentList is a class name symbol,

(. clojure.lang.PersistentList creator)

is an access of the static creator field.

https://github.com/clojure/clojure/blob/clojure-1.8.0/src/jvm/clojure/lang/PersistentList.java#L66

Sign up to request clarification or add additional context in comments.

2 Comments

Im used to seeing clojure.lang.PersistentList/creator for static access, so that threw me off. Thanks.
This function was written before the Foo/bar syntax was added to the language.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.