The :pass-info metadata needed to resolve the pass dependency order is
attached to the Vars, not to the functions.
Even though we could attach that meta to the functions rather than to
the Vars, leaving aside that it would be less pleasant, multimethods
can't have metadata attached as they are not AFunctions so that would
require wrapping each pass in a fn even when unnecessary.

Given all this, using a set of Vars is perfectly reasonable.

Nicola

Dave Sann writes:

> Hi Nicola,
>
> why do you pass a set of vars to schedule rather than a set of functions?
>
> I'm just interested. It's unusual to see #'
>
> Dave
>
> On Friday, 19 September 2014 05:07:08 UTC+10, Nicola Mometto wrote:
>>
>>
>> Today I released version 0.6.0 of the tools.analyzer[1] and
>> tools.analyzer.jvm[2] contrib libraries.
>>
>> With this release comes a new feature I'm really excited about and that
>> I believe will help users of this library significantly: a pass
>> scheduler.
>>
>> Previous to this release, tools.analyzer passes had to be combined
>> manually, requiring deep knowledge of the implementation of those
>> passes, whose dependencies were not explicit.
>>
>> That usually resulted in users copy-pasting the tools.analyzer.jvm
>> run-passes function using that as a template.
>>
>> With the new scheduler, all of this is no longer necessary as all it
>> takes care of automatically pulling in dependencies and composing the
>> passes in the required and most efficient order, composing together
>> passes whenever possible, to minimize the overhead of a full tree
>> traversal.
>>
>> To get a sense of how that has improved, here's run-passes from 0.5.6:
>>
>> https://github.com/clojure/tools.analyzer.jvm/blob/be55b4e32371060932ac8d4094eb5b1b77fe4349/src/main/clojure/clojure/tools/analyzer/jvm.clj#L430-L477
>> and here it is from 0.6.0, using the pass scheduler:
>>
>> https://github.com/clojure/tools.analyzer.jvm/blob/1757871eb828c419f8de1cf177f125897f653829/src/main/clojure/clojure/tools/analyzer/jvm.clj#L397-L427
>>
>> Exposing the default-passes set, users who want to add a pass to the
>> default passes run by t.a.jvm need only to bind run-passes to
>> `(schedule (conj default-passes #'my-pass))`, or dissoc a default pass
>> if not needed.
>>
>> To get started with the pass scheduler, here's its extensive docstring:
>>
>> https://github.com/clojure/tools.analyzer/blob/7a8cba9b26689675debdaabc83f20e485003bf5a/src/main/clojure/clojure/tools/analyzer/passes.clj#L137-L168
>> and here is a comprehensive example of a pass configuration via
>> :pass-info:
>>
>> https://github.com/clojure/tools.analyzer.jvm/blob/1757871eb828c419f8de1cf177f125897f653829/src/main/clojure/clojure/tools/analyzer/passes/jvm/validate_loop_locals.clj#L150
>>
>> Nicola
>>
>> [1]https://github.com/clojure/tools.analyzer
>> [2]https://github.com/clojure/tools.analyzer.jvm
>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to