On Wed, Jan 9, 2013 at 10:17 AM, Wujek Srujek <[email protected]>wrote:
> So take this definition from master:
>
> (def
>
> ^{:arglists '([x])
> :doc "Return true if x implements ISeq"
> :added "1.0"
> :static true}
> seq? (fn ^:static seq? [x] (instance? clojure.lang.ISeq x)))
>
> static is used twice here. What is / was the difference? Is it correct to say
> that it is now just noise in the code and could be stripped away? Is it
> correct to say it has nothing to do with 'dynamic', contrary to what the last
> SO post in the topic you linked to implies?
>
>
^:static really had/has nothing to do with ^:dynamic. It was an experiment
Rich was doing to improve performance by generating a static Class
method as opposed to an instance of IFn. So, ^:static here is referring to
the static keyword from Java.
The ^:static metadata had to be there during the definition of the function
itself for the compiler to know to emit a static method, so the first
":static true" in your example is unnecessary. If it wasn't there though,
during runtime (:static (meta #'seq)) would be nil which might be confusing.
Those hoops are only necessary because defn hasn't been defined yet at that
point of core.clj.
--Aaron
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en