Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-09-08 Thread Michael Griffiths
Hi Nicola,
 
This is great stuff. Are there plans for a tools.emitter.js?
 
Thanks,
 
Michael

-- 
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.


Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-23 Thread dmiller
Hi, Alex.

I'll send you a few thoughts on this.  The reader problem is the biggest 
issue.

-David


On Thursday, August 21, 2014 8:01:29 PM UTC-5, Alex Miller wrote:
>
> Hey David,
>
> I'm working on the feature expressions stuff. At the moment I've been 
> focusing on the clj/cljs use case as that seems to be most urgent. I had 
> been planning to circle back around to clr eventually though and would be 
> very interested in any known issues.
>
> Alex
>
>

-- 
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.


Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-21 Thread Colin Fleming
Hi Alex,

Is the current feature expressions design basically what's under "Proposed
Solution: feature expressions" at
http://dev.clojure.org/display/design/Feature+Expressions? I read through
the comments a while back and a lot of the suggestions there got fairly
complicated, I'd be interested to know what the current plan is.

Cheers,
Colin


On 22 August 2014 13:01, Alex Miller  wrote:

> Hey David,
>
> I'm working on the feature expressions stuff. At the moment I've been
> focusing on the clj/cljs use case as that seems to be most urgent. I had
> been planning to circle back around to clr eventually though and would be
> very interested in any known issues.
>
> Alex
>
> --
> 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.
>

-- 
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.


Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-21 Thread Alex Miller
Hey David,

I'm working on the feature expressions stuff. At the moment I've been focusing 
on the clj/cljs use case as that seems to be most urgent. I had been planning 
to circle back around to clr eventually though and would be very interested in 
any known issues.

Alex

-- 
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.


Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-21 Thread dmiller
Nicola,

Thanks for the very helpful comments.
I'll likely proceed with the translation -- there are calls to get 
core.async sync'ed up with the JVM version and tools.analyzer.* has to be 
there.

Thanks for pointing me to the feature expressions discussion.  That will be 
extremely useful, should it come to pass.  There are some interesting 
problems that I'm pretty sure haven't been considered yet.  The ClojureCLR 
lisp-reader requires an extension to symbol token lexing in order to 
accommodate the full range of type names in the CLR -- that will make some 
*.clj files written for ClojureCLR to be unreadable by other Clojure 
implementations even with feature expressions.  There are other 
considerations, but I'll pursue them in that discussion.

Thank you for offer to provide advice.  I'll be in touch as I move this 
forward.

-David


On Thursday, August 21, 2014 7:14:15 AM UTC-5, Nicola Mometto wrote:
>
>
> David, 
>
> I personally have no plans to port tools.analyzer.jvm to a 
> tools.analyzer.clr, not for disinterest but simply because I don't know 
> anything about the .NET platform nor about clojureCLR. 
>
> That said, it shouldn't be hard to port it at all, the main file to port 
> would be 
>
> https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/jvm/utils.clj
>  
> which contains most of the functions that deal with reflection on t.a.jvm, 
> everything else should just be a matter of replacing class names from 
> java.lang.* to their CLR counterpart. 
>
> The only issue with all this, is that ATM tools.analyzer itself can only 
> run on clojure on the JVM because of 
>
> https://github.com/clojure/tools.analyzer/blob/master/src/main/clojure/clojure/tools/analyzer/utils.clj#L67-L70
>  
>
> My suggestion would be to wait for clojure 1.7 which should have support 
> for feature expressions and would make it possible for tools.analyzer to 
> be source compatible with clojureCLR too (all the code except for that 
> line is pure clojure, there are a bunch of instance checks for 
> clojure.lang.* types but it's my understanding that clojureCLR maintains 
> that class hierarchy). 
>
> A relevant ticket that might add a pattern? function to core that would 
> solve this is http://dev.clojure.org/jira/browse/CLJ-1298 
>
> In any case, if you want to go ahead and start porting t.a.jvm to 
> t.a.clr until we wait for 1.7 and feature-expressions or `c.c/pattern?`, 
> feel free to contact me privately and we can discuss this further. 
>
> Thanks, 
> Nicola 
>
> dmiller writes: 
>
> > Nicola, 
> > 
> > Excellent work! 
> > 
> > Looking forward to seeing tools.analyzer.clr in the near future. :) 
> > 
> > Well, actually, seriously, with the use of tools.analyzer.* in critical 
> > projects such as core.async, a port of tools.analyzer.jvm seems 
> necessary. 
> >   Unless you know of plans to make a port, I'll add it to my queue.  Any 
> > hints/suggestions/comments you can offer will be received 
> appreciatively. 
> > 
>

-- 
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.


Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-21 Thread Nicola Mometto

David,

I personally have no plans to port tools.analyzer.jvm to a
tools.analyzer.clr, not for disinterest but simply because I don't know
anything about the .NET platform nor about clojureCLR.

That said, it shouldn't be hard to port it at all, the main file to port
would be
https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/jvm/utils.clj
which contains most of the functions that deal with reflection on t.a.jvm,
everything else should just be a matter of replacing class names from
java.lang.* to their CLR counterpart.

The only issue with all this, is that ATM tools.analyzer itself can only
run on clojure on the JVM because of
https://github.com/clojure/tools.analyzer/blob/master/src/main/clojure/clojure/tools/analyzer/utils.clj#L67-L70

My suggestion would be to wait for clojure 1.7 which should have support
for feature expressions and would make it possible for tools.analyzer to
be source compatible with clojureCLR too (all the code except for that
line is pure clojure, there are a bunch of instance checks for
clojure.lang.* types but it's my understanding that clojureCLR maintains
that class hierarchy).

A relevant ticket that might add a pattern? function to core that would
solve this is http://dev.clojure.org/jira/browse/CLJ-1298

In any case, if you want to go ahead and start porting t.a.jvm to
t.a.clr until we wait for 1.7 and feature-expressions or `c.c/pattern?`,
feel free to contact me privately and we can discuss this further.

Thanks,
Nicola

dmiller writes:

> Nicola,
>
> Excellent work!
>
> Looking forward to seeing tools.analyzer.clr in the near future. :)
>
> Well, actually, seriously, with the use of tools.analyzer.* in critical
> projects such as core.async, a port of tools.analyzer.jvm seems necessary.
>   Unless you know of plans to make a port, I'll add it to my queue.  Any
> hints/suggestions/comments you can offer will be received appreciatively.
>

-- 
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.


Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-20 Thread dmiller
Nicola,

Excellent work!

Looking forward to seeing tools.analyzer.clr in the near future. :)

Well, actually, seriously, with the use of tools.analyzer.* in critical 
projects such as core.async, a port of tools.analyzer.jvm seems necessary. 
  Unless you know of plans to make a port, I'll add it to my queue.  Any 
hints/suggestions/comments you can offer will be received appreciatively.

-David


On Wednesday, August 13, 2014 11:54:54 AM UTC-5, Nicola Mometto wrote:
>
>
> As some of you might know, I've been working contiuously on my various 
> tools.* contrib libraries for the past months and I've recently added 
> tools.analyzer.js to the list of contrib libraries I maintain. 
>
> Since I don't blog/tweet much about those libraries, I thought I'd write 
> a report to let the community aware of the status of those libraries. 
>
> ## tools.analyzer https://github.com/clojure/tools.analyzer 
>
> tools.analyzer is a host-agnostic pluggable analyzer and collection of 
> passes producing an AST in clojure data structures for clojure and 
> other languages in the clojure language family, like clojurescript. 
>
>
>

-- 
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.


Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-19 Thread Francesco Bellomi
Nicola,

of course you're right.

I recently switched to the 3-ary analyze in order to 
use :validate/wrong-tag-handler and I was wrongly passing {} as the env, 
instead of (empty-env).
When I saw the "Invalid token: ::a/b" errors I was fooled into thinking 
they were purely syntactical errors (but still -- that would be the reader, 
as you said), and didn't check the environment.

(btw, I'm using my own analyze-ns because I'm interested in trying to go 
ahead even if the evaluation of some top-level form fails)

Sorry for the noise, and thanks again for your work

Francesco




On Tuesday, August 19, 2014 10:18:56 PM UTC+2, Nicola Mometto wrote:
>
>
> Francesco, 
> that doesn't seem to be the case in my tests: 
>
> [~/src/tools.analyzer.jvm/src/main/clojure]> cat test.clj 
> (ns test (:require [clojure.string :as s])) 
> ::s/foo 
>
> clojure.tools.analyzer.jvm> (-> (analyze-ns 'test) last :form) 
> :clojure.string/foo 
>
> Note that to analyze keywords in the form ::foo/bar, *ns* has to be set 
> and all the aliases need to be setup, this can only happen if the ns 
> form is evaluated after being analyzed, using analyze+eval or analyze-ns 
> directly, there's an explaination on the tools.analyzer.jvm README 
> regarding why `analyze` shouldn't be used to analyze whole namespaces 
> and why you whould use analyze+eval or analyze-ns instead. 
>
> In any case, keywords in the form ::foo/bar are resolved by the reader, 
> not the analyzer. 
>
> Nicola 
>
> Francesco Bellomi writes: 
>
> > Nicola, 
> > 
> > thank you for your work, and for :validate/wrong-tag-handler 
> specifically, 
> > which is very useful to me. 
> > 
> > It seems that analyzer refuses keywords in the form ::a/b, which are 
> used 
> > in some projects 
> > (e.g. [org.clojure/core.typed] clojure.core.typed.check.fn contains 
> > ::t/cmethods at line 21). 
> > 
> > Francesco 
> > 
> > 
> > On Wednesday, August 13, 2014 6:54:54 PM UTC+2, Nicola Mometto wrote: 
> >> 
> >> 
> >> As some of you might know, I've been working contiuously on my various 
> >> tools.* contrib libraries for the past months and I've recently added 
> >> tools.analyzer.js to the list of contrib libraries I maintain. 
> >> 
> >> Since I don't blog/tweet much about those libraries, I thought I'd 
> write 
> >> a report to let the community aware of the status of those libraries. 
> >> 
> >> ## tools.analyzer https://github.com/clojure/tools.analyzer 
> >> 
> >> tools.analyzer is a host-agnostic pluggable analyzer and collection of 
> >> passes producing an AST in clojure data structures for clojure and 
> >> other languages in the clojure language family, like clojurescript. 
> >> 
> >> The current release is 0.5.1, here's a list of notable changes that 
> have 
> >> made in in the last few months: 
> >> 
> >> * The analyzer now uses different environments for lexical state (like 
> >>   the locals map) and for global state (like namespaces mappings); the 
> >>   former is just a regular map passed to an analyze call, the latter is 
> >>   a dynamic var holding an atom and lives in the tools.analyzer.env 
> >>   namespace along with functions to setup/manipulate it. 
> >> 
> >> * The metadata elision mechanism has been vastly improved, allowing to 
> >>   specify different keys to elide based on the node :op, aswell as 
> based 
> >>   on a predicate rather than simple key matching. 
> >> 
> >> * The env context now partecipates in a keyword hierarchy, the default 
> >>   contexts are :ctx/statement, :ctx/return and :ctx/expr and other 
> >>   contexts can be derived from those, as an example tools.analyzer 
> >>   utilizes :ctx.invoke/target and :ctx.invoke/params for nodes in 
> invoke 
> >>   position. 
> >> 
> >> * Dispatch on clojure expressions types has been opened with the 
> >>   -analyze-form multimethod, allowing to provide custom evaluation 
> >>   strategies for custom types (this was needed for tools.analyzer.js 
> >>   because of clojurescript's #js syntax) 
> >> 
> >> * Documentation has been vastly improved with docstrings for every 
> >>   public function and pass, and the addition of an official AST 
> >>   quickref http://clojure.github.io/tools.analyzer/spec/quickref.html 
> >> 
> >> For a complete list of changes, refer to the CHANGELOG: 
> >> https://github.com/clojure/tools.analyzer/blob/master/CHANGELOG.md 
> >> 
> >> For more informations and examples, refer to the README: 
> >> https://github.com/clojure/tools.analyzer/blob/master/README.md 
> >> 
> >> ## tools.analyzer.jvm https://github.com/clojure/tools.analyzer.jvm 
> >> 
> >> tools.analyzer.jvm is a jvm-specific tools.analyzer extension, 
> >> collection of passes and useful functions to deal with analysis of 
> >> clojure on the JVM code. 
> >> 
> >> The current release is 0.5.2, here's a list of notable changes that 
> have 
> >> made in the last few months: 
> >> 
> >> * Added an analyze-ns function that returns a vector of AST nodes for 
> >>   every top-level form in that namespace; e

Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-19 Thread Nicola Mometto

Francesco,
that doesn't seem to be the case in my tests:

[~/src/tools.analyzer.jvm/src/main/clojure]> cat test.clj
(ns test (:require [clojure.string :as s]))
::s/foo

clojure.tools.analyzer.jvm> (-> (analyze-ns 'test) last :form)
:clojure.string/foo

Note that to analyze keywords in the form ::foo/bar, *ns* has to be set
and all the aliases need to be setup, this can only happen if the ns
form is evaluated after being analyzed, using analyze+eval or analyze-ns
directly, there's an explaination on the tools.analyzer.jvm README
regarding why `analyze` shouldn't be used to analyze whole namespaces
and why you whould use analyze+eval or analyze-ns instead.

In any case, keywords in the form ::foo/bar are resolved by the reader,
not the analyzer.

Nicola

Francesco Bellomi writes:

> Nicola,
>
> thank you for your work, and for :validate/wrong-tag-handler specifically,
> which is very useful to me.
>
> It seems that analyzer refuses keywords in the form ::a/b, which are used
> in some projects
> (e.g. [org.clojure/core.typed] clojure.core.typed.check.fn contains
> ::t/cmethods at line 21).
>
> Francesco
>
>
> On Wednesday, August 13, 2014 6:54:54 PM UTC+2, Nicola Mometto wrote:
>>
>>
>> As some of you might know, I've been working contiuously on my various
>> tools.* contrib libraries for the past months and I've recently added
>> tools.analyzer.js to the list of contrib libraries I maintain.
>>
>> Since I don't blog/tweet much about those libraries, I thought I'd write
>> a report to let the community aware of the status of those libraries.
>>
>> ## tools.analyzer https://github.com/clojure/tools.analyzer
>>
>> tools.analyzer is a host-agnostic pluggable analyzer and collection of
>> passes producing an AST in clojure data structures for clojure and
>> other languages in the clojure language family, like clojurescript.
>>
>> The current release is 0.5.1, here's a list of notable changes that have
>> made in in the last few months:
>>
>> * The analyzer now uses different environments for lexical state (like
>>   the locals map) and for global state (like namespaces mappings); the
>>   former is just a regular map passed to an analyze call, the latter is
>>   a dynamic var holding an atom and lives in the tools.analyzer.env
>>   namespace along with functions to setup/manipulate it.
>>
>> * The metadata elision mechanism has been vastly improved, allowing to
>>   specify different keys to elide based on the node :op, aswell as based
>>   on a predicate rather than simple key matching.
>>
>> * The env context now partecipates in a keyword hierarchy, the default
>>   contexts are :ctx/statement, :ctx/return and :ctx/expr and other
>>   contexts can be derived from those, as an example tools.analyzer
>>   utilizes :ctx.invoke/target and :ctx.invoke/params for nodes in invoke
>>   position.
>>
>> * Dispatch on clojure expressions types has been opened with the
>>   -analyze-form multimethod, allowing to provide custom evaluation
>>   strategies for custom types (this was needed for tools.analyzer.js
>>   because of clojurescript's #js syntax)
>>
>> * Documentation has been vastly improved with docstrings for every
>>   public function and pass, and the addition of an official AST
>>   quickref http://clojure.github.io/tools.analyzer/spec/quickref.html
>>
>> For a complete list of changes, refer to the CHANGELOG:
>> https://github.com/clojure/tools.analyzer/blob/master/CHANGELOG.md
>>
>> For more informations and examples, refer to the README:
>> https://github.com/clojure/tools.analyzer/blob/master/README.md
>>
>> ## tools.analyzer.jvm https://github.com/clojure/tools.analyzer.jvm
>>
>> tools.analyzer.jvm is a jvm-specific tools.analyzer extension,
>> collection of passes and useful functions to deal with analysis of
>> clojure on the JVM code.
>>
>> The current release is 0.5.2, here's a list of notable changes that have
>> made in the last few months:
>>
>> * Added an analyze-ns function that returns a vector of AST nodes for
>>   every top-level form in that namespace; evaluates each form.
>>
>> * Added a configurable handler for wrong tags: while Clojure is
>>   permissive of type hints that don't resolve to a Class which it
>>   simply ignores in most cases, tools.analyzer.jvm's default behaviour
>>   has always been to throw an exception in those cases. This has been a
>>   longstanding issue for tools like eastwood that want to simply emit a
>>   warning on those cases rather than stopping analysis and error out.
>>   With the addition of this handlers, users can now control what happens
>>   when t.a.jvm hits a tag that can't be resolved to a Class.
>>
>> * Added optional Var-level tag inference
>>
>> * Improved analyze+eval to attach the result of the evaluation of the
>>   node to the AST, wrapping potential exceptions at evaluation time in
>>   an ExceptionThrown record.
>>
>> * Documentation has been vastly improved with docstrings for every
>>   public function and pass, and the addition of an offici

Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-19 Thread Francesco Bellomi
Nicola,

thank you for your work, and for :validate/wrong-tag-handler specifically, 
which is very useful to me.

It seems that analyzer refuses keywords in the form ::a/b, which are used 
in some projects
(e.g. [org.clojure/core.typed] clojure.core.typed.check.fn contains 
::t/cmethods at line 21).

Francesco


On Wednesday, August 13, 2014 6:54:54 PM UTC+2, Nicola Mometto wrote:
>
>
> As some of you might know, I've been working contiuously on my various 
> tools.* contrib libraries for the past months and I've recently added 
> tools.analyzer.js to the list of contrib libraries I maintain. 
>
> Since I don't blog/tweet much about those libraries, I thought I'd write 
> a report to let the community aware of the status of those libraries. 
>
> ## tools.analyzer https://github.com/clojure/tools.analyzer 
>
> tools.analyzer is a host-agnostic pluggable analyzer and collection of 
> passes producing an AST in clojure data structures for clojure and 
> other languages in the clojure language family, like clojurescript. 
>
> The current release is 0.5.1, here's a list of notable changes that have 
> made in in the last few months: 
>
> * The analyzer now uses different environments for lexical state (like 
>   the locals map) and for global state (like namespaces mappings); the 
>   former is just a regular map passed to an analyze call, the latter is 
>   a dynamic var holding an atom and lives in the tools.analyzer.env 
>   namespace along with functions to setup/manipulate it. 
>
> * The metadata elision mechanism has been vastly improved, allowing to 
>   specify different keys to elide based on the node :op, aswell as based 
>   on a predicate rather than simple key matching. 
>
> * The env context now partecipates in a keyword hierarchy, the default 
>   contexts are :ctx/statement, :ctx/return and :ctx/expr and other 
>   contexts can be derived from those, as an example tools.analyzer 
>   utilizes :ctx.invoke/target and :ctx.invoke/params for nodes in invoke 
>   position. 
>
> * Dispatch on clojure expressions types has been opened with the 
>   -analyze-form multimethod, allowing to provide custom evaluation 
>   strategies for custom types (this was needed for tools.analyzer.js 
>   because of clojurescript's #js syntax) 
>
> * Documentation has been vastly improved with docstrings for every 
>   public function and pass, and the addition of an official AST 
>   quickref http://clojure.github.io/tools.analyzer/spec/quickref.html 
>
> For a complete list of changes, refer to the CHANGELOG: 
> https://github.com/clojure/tools.analyzer/blob/master/CHANGELOG.md 
>
> For more informations and examples, refer to the README: 
> https://github.com/clojure/tools.analyzer/blob/master/README.md 
>
> ## tools.analyzer.jvm https://github.com/clojure/tools.analyzer.jvm 
>
> tools.analyzer.jvm is a jvm-specific tools.analyzer extension, 
> collection of passes and useful functions to deal with analysis of 
> clojure on the JVM code. 
>
> The current release is 0.5.2, here's a list of notable changes that have 
> made in the last few months: 
>
> * Added an analyze-ns function that returns a vector of AST nodes for 
>   every top-level form in that namespace; evaluates each form. 
>
> * Added a configurable handler for wrong tags: while Clojure is 
>   permissive of type hints that don't resolve to a Class which it 
>   simply ignores in most cases, tools.analyzer.jvm's default behaviour 
>   has always been to throw an exception in those cases. This has been a 
>   longstanding issue for tools like eastwood that want to simply emit a 
>   warning on those cases rather than stopping analysis and error out. 
>   With the addition of this handlers, users can now control what happens 
>   when t.a.jvm hits a tag that can't be resolved to a Class. 
>
> * Added optional Var-level tag inference 
>
> * Improved analyze+eval to attach the result of the evaluation of the 
>   node to the AST, wrapping potential exceptions at evaluation time in 
>   an ExceptionThrown record. 
>
> * Documentation has been vastly improved with docstrings for every 
>   public function and pass, and the addition of an official AST 
>   quickref http://clojure.github.io/tools.analyzer.jvm/spec/quickref.html 
>
> For a complete list of changes, refer to the CHANGELOG: 
> https://github.com/clojure/tools.analyzer.jvm/blob/master/CHANGELOG.md 
>
> For more informations and examples, refer to the README: 
> https://github.com/clojure/tools.analyzer.jvm/blob/master/README.md 
>
> ## tools.analyzer.js https://github.com/clojure/tools.analyzer.js 
>
> tools.analyzer.js is a js-specific tools.analyzer extension, collection 
> of passes and useful functions to deal with analysis of clojurescript 
> code. 
>
> The current release is 0.1.0-beta4. 
>
> The produced AST is not compatible with the one produced by 
> cljs.analyzer even though they are similar as the cljs analyzer heavily 
> influenced the AST format of tools.analyzer. 
> tools.analyzer.js h

Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-19 Thread Francesco Bellomi
Nicola,

thank you for your work, and for :validate/wrong-tag-handler specifically, 
which is very useful to me.

It seems that analyzer refuses keywords in the form ::a/b, which are used 
in some projects
(e.g. [org.clojure/core.typed] clojure.core.typed.check.fn contains 
::t/cmethods at line 21).

Francesco


org.clojure/core.typed clojure.core.typed.check.fnorg.clojure/core.typed 
clojure.core.typed.check.fn
On Wednesday, August 13, 2014 6:54:54 PM UTC+2, Nicola Mometto wrote:
>
>
> As some of you might know, I've been working contiuously on my various 
> tools.* contrib libraries for the past months and I've recently added 
> tools.analyzer.js to the list of contrib libraries I maintain. 
>
> Since I don't blog/tweet much about those libraries, I thought I'd write 
> a report to let the community aware of the status of those libraries. 
>
> ## tools.analyzer https://github.com/clojure/tools.analyzer 
>
> tools.analyzer is a host-agnostic pluggable analyzer and collection of 
> passes producing an AST in clojure data structures for clojure and 
> other languages in the clojure language family, like clojurescript. 
>
> The current release is 0.5.1, here's a list of notable changes that have 
> made in in the last few months: 
>
> * The analyzer now uses different environments for lexical state (like 
>   the locals map) and for global state (like namespaces mappings); the 
>   former is just a regular map passed to an analyze call, the latter is 
>   a dynamic var holding an atom and lives in the tools.analyzer.env 
>   namespace along with functions to setup/manipulate it. 
>
> * The metadata elision mechanism has been vastly improved, allowing to 
>   specify different keys to elide based on the node :op, aswell as based 
>   on a predicate rather than simple key matching. 
>
> * The env context now partecipates in a keyword hierarchy, the default 
>   contexts are :ctx/statement, :ctx/return and :ctx/expr and other 
>   contexts can be derived from those, as an example tools.analyzer 
>   utilizes :ctx.invoke/target and :ctx.invoke/params for nodes in invoke 
>   position. 
>
> * Dispatch on clojure expressions types has been opened with the 
>   -analyze-form multimethod, allowing to provide custom evaluation 
>   strategies for custom types (this was needed for tools.analyzer.js 
>   because of clojurescript's #js syntax) 
>
> * Documentation has been vastly improved with docstrings for every 
>   public function and pass, and the addition of an official AST 
>   quickref http://clojure.github.io/tools.analyzer/spec/quickref.html 
>
> For a complete list of changes, refer to the CHANGELOG: 
> https://github.com/clojure/tools.analyzer/blob/master/CHANGELOG.md 
>
> For more informations and examples, refer to the README: 
> https://github.com/clojure/tools.analyzer/blob/master/README.md 
>
> ## tools.analyzer.jvm https://github.com/clojure/tools.analyzer.jvm 
>
> tools.analyzer.jvm is a jvm-specific tools.analyzer extension, 
> collection of passes and useful functions to deal with analysis of 
> clojure on the JVM code. 
>
> The current release is 0.5.2, here's a list of notable changes that have 
> made in the last few months: 
>
> * Added an analyze-ns function that returns a vector of AST nodes for 
>   every top-level form in that namespace; evaluates each form. 
>
> * Added a configurable handler for wrong tags: while Clojure is 
>   permissive of type hints that don't resolve to a Class which it 
>   simply ignores in most cases, tools.analyzer.jvm's default behaviour 
>   has always been to throw an exception in those cases. This has been a 
>   longstanding issue for tools like eastwood that want to simply emit a 
>   warning on those cases rather than stopping analysis and error out. 
>   With the addition of this handlers, users can now control what happens 
>   when t.a.jvm hits a tag that can't be resolved to a Class. 
>
> * Added optional Var-level tag inference 
>
> * Improved analyze+eval to attach the result of the evaluation of the 
>   node to the AST, wrapping potential exceptions at evaluation time in 
>   an ExceptionThrown record. 
>
> * Documentation has been vastly improved with docstrings for every 
>   public function and pass, and the addition of an official AST 
>   quickref http://clojure.github.io/tools.analyzer.jvm/spec/quickref.html 
>
> For a complete list of changes, refer to the CHANGELOG: 
> https://github.com/clojure/tools.analyzer.jvm/blob/master/CHANGELOG.md 
>
> For more informations and examples, refer to the README: 
> https://github.com/clojure/tools.analyzer.jvm/blob/master/README.md 
>
> ## tools.analyzer.js https://github.com/clojure/tools.analyzer.js 
>
> tools.analyzer.js is a js-specific tools.analyzer extension, collection 
> of passes and useful functions to deal with analysis of clojurescript 
> code. 
>
> The current release is 0.1.0-beta4. 
>
> The produced AST is not compatible with the one produced by 
> cljs.analyzer even though they are simil

Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-13 Thread Ivan L
Keep up the great work Nicola.

On Wednesday, August 13, 2014 12:54:54 PM UTC-4, Nicola Mometto wrote:
>
>
> As some of you might know, I've been working contiuously on my various 
> tools.* contrib libraries for the past months and I've recently added 
> tools.analyzer.js to the list of contrib libraries I maintain. 
>
> Since I don't blog/tweet much about those libraries, I thought I'd write 
> a report to let the community aware of the status of those libraries. 
>
> ## tools.analyzer https://github.com/clojure/tools.analyzer 
>
> tools.analyzer is a host-agnostic pluggable analyzer and collection of 
> passes producing an AST in clojure data structures for clojure and 
> other languages in the clojure language family, like clojurescript. 
>
> The current release is 0.5.1, here's a list of notable changes that have 
> made in in the last few months: 
>
> * The analyzer now uses different environments for lexical state (like 
>   the locals map) and for global state (like namespaces mappings); the 
>   former is just a regular map passed to an analyze call, the latter is 
>   a dynamic var holding an atom and lives in the tools.analyzer.env 
>   namespace along with functions to setup/manipulate it. 
>
> * The metadata elision mechanism has been vastly improved, allowing to 
>   specify different keys to elide based on the node :op, aswell as based 
>   on a predicate rather than simple key matching. 
>
> * The env context now partecipates in a keyword hierarchy, the default 
>   contexts are :ctx/statement, :ctx/return and :ctx/expr and other 
>   contexts can be derived from those, as an example tools.analyzer 
>   utilizes :ctx.invoke/target and :ctx.invoke/params for nodes in invoke 
>   position. 
>
> * Dispatch on clojure expressions types has been opened with the 
>   -analyze-form multimethod, allowing to provide custom evaluation 
>   strategies for custom types (this was needed for tools.analyzer.js 
>   because of clojurescript's #js syntax) 
>
> * Documentation has been vastly improved with docstrings for every 
>   public function and pass, and the addition of an official AST 
>   quickref http://clojure.github.io/tools.analyzer/spec/quickref.html 
>
> For a complete list of changes, refer to the CHANGELOG: 
> https://github.com/clojure/tools.analyzer/blob/master/CHANGELOG.md 
>
> For more informations and examples, refer to the README: 
> https://github.com/clojure/tools.analyzer/blob/master/README.md 
>
> ## tools.analyzer.jvm https://github.com/clojure/tools.analyzer.jvm 
>
> tools.analyzer.jvm is a jvm-specific tools.analyzer extension, 
> collection of passes and useful functions to deal with analysis of 
> clojure on the JVM code. 
>
> The current release is 0.5.2, here's a list of notable changes that have 
> made in the last few months: 
>
> * Added an analyze-ns function that returns a vector of AST nodes for 
>   every top-level form in that namespace; evaluates each form. 
>
> * Added a configurable handler for wrong tags: while Clojure is 
>   permissive of type hints that don't resolve to a Class which it 
>   simply ignores in most cases, tools.analyzer.jvm's default behaviour 
>   has always been to throw an exception in those cases. This has been a 
>   longstanding issue for tools like eastwood that want to simply emit a 
>   warning on those cases rather than stopping analysis and error out. 
>   With the addition of this handlers, users can now control what happens 
>   when t.a.jvm hits a tag that can't be resolved to a Class. 
>
> * Added optional Var-level tag inference 
>
> * Improved analyze+eval to attach the result of the evaluation of the 
>   node to the AST, wrapping potential exceptions at evaluation time in 
>   an ExceptionThrown record. 
>
> * Documentation has been vastly improved with docstrings for every 
>   public function and pass, and the addition of an official AST 
>   quickref http://clojure.github.io/tools.analyzer.jvm/spec/quickref.html 
>
> For a complete list of changes, refer to the CHANGELOG: 
> https://github.com/clojure/tools.analyzer.jvm/blob/master/CHANGELOG.md 
>
> For more informations and examples, refer to the README: 
> https://github.com/clojure/tools.analyzer.jvm/blob/master/README.md 
>
> ## tools.analyzer.js https://github.com/clojure/tools.analyzer.js 
>
> tools.analyzer.js is a js-specific tools.analyzer extension, collection 
> of passes and useful functions to deal with analysis of clojurescript 
> code. 
>
> The current release is 0.1.0-beta4. 
>
> The produced AST is not compatible with the one produced by 
> cljs.analyzer even though they are similar as the cljs analyzer heavily 
> influenced the AST format of tools.analyzer. 
> tools.analyzer.js has several advantages over cljs.analyzer: 
>
> * Heavily modular implementation, thanks to the :children-walking based 
>   multi-pass design. 
>
> * Unified AST format and analyzer interface between clj and cljs code 
>   analyzers, this will allow library authors to write passes

Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-13 Thread Eric Normand
This looks really awesome!

-- 
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.


Re: tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-13 Thread adrian . medina
You rule Nicola! I really appreciate all of the work you've put into this. 
Your code has forever influenced the way I write lexical analyzers with 
Clojure. :)

On Wednesday, August 13, 2014 12:54:54 PM UTC-4, Nicola Mometto wrote:
>
>
> As some of you might know, I've been working contiuously on my various 
> tools.* contrib libraries for the past months and I've recently added 
> tools.analyzer.js to the list of contrib libraries I maintain. 
>
> Since I don't blog/tweet much about those libraries, I thought I'd write 
> a report to let the community aware of the status of those libraries. 
>
> ## tools.analyzer https://github.com/clojure/tools.analyzer 
>
> tools.analyzer is a host-agnostic pluggable analyzer and collection of 
> passes producing an AST in clojure data structures for clojure and 
> other languages in the clojure language family, like clojurescript. 
>
> The current release is 0.5.1, here's a list of notable changes that have 
> made in in the last few months: 
>
> * The analyzer now uses different environments for lexical state (like 
>   the locals map) and for global state (like namespaces mappings); the 
>   former is just a regular map passed to an analyze call, the latter is 
>   a dynamic var holding an atom and lives in the tools.analyzer.env 
>   namespace along with functions to setup/manipulate it. 
>
> * The metadata elision mechanism has been vastly improved, allowing to 
>   specify different keys to elide based on the node :op, aswell as based 
>   on a predicate rather than simple key matching. 
>
> * The env context now partecipates in a keyword hierarchy, the default 
>   contexts are :ctx/statement, :ctx/return and :ctx/expr and other 
>   contexts can be derived from those, as an example tools.analyzer 
>   utilizes :ctx.invoke/target and :ctx.invoke/params for nodes in invoke 
>   position. 
>
> * Dispatch on clojure expressions types has been opened with the 
>   -analyze-form multimethod, allowing to provide custom evaluation 
>   strategies for custom types (this was needed for tools.analyzer.js 
>   because of clojurescript's #js syntax) 
>
> * Documentation has been vastly improved with docstrings for every 
>   public function and pass, and the addition of an official AST 
>   quickref http://clojure.github.io/tools.analyzer/spec/quickref.html 
>
> For a complete list of changes, refer to the CHANGELOG: 
> https://github.com/clojure/tools.analyzer/blob/master/CHANGELOG.md 
>
> For more informations and examples, refer to the README: 
> https://github.com/clojure/tools.analyzer/blob/master/README.md 
>
> ## tools.analyzer.jvm https://github.com/clojure/tools.analyzer.jvm 
>
> tools.analyzer.jvm is a jvm-specific tools.analyzer extension, 
> collection of passes and useful functions to deal with analysis of 
> clojure on the JVM code. 
>
> The current release is 0.5.2, here's a list of notable changes that have 
> made in the last few months: 
>
> * Added an analyze-ns function that returns a vector of AST nodes for 
>   every top-level form in that namespace; evaluates each form. 
>
> * Added a configurable handler for wrong tags: while Clojure is 
>   permissive of type hints that don't resolve to a Class which it 
>   simply ignores in most cases, tools.analyzer.jvm's default behaviour 
>   has always been to throw an exception in those cases. This has been a 
>   longstanding issue for tools like eastwood that want to simply emit a 
>   warning on those cases rather than stopping analysis and error out. 
>   With the addition of this handlers, users can now control what happens 
>   when t.a.jvm hits a tag that can't be resolved to a Class. 
>
> * Added optional Var-level tag inference 
>
> * Improved analyze+eval to attach the result of the evaluation of the 
>   node to the AST, wrapping potential exceptions at evaluation time in 
>   an ExceptionThrown record. 
>
> * Documentation has been vastly improved with docstrings for every 
>   public function and pass, and the addition of an official AST 
>   quickref http://clojure.github.io/tools.analyzer.jvm/spec/quickref.html 
>
> For a complete list of changes, refer to the CHANGELOG: 
> https://github.com/clojure/tools.analyzer.jvm/blob/master/CHANGELOG.md 
>
> For more informations and examples, refer to the README: 
> https://github.com/clojure/tools.analyzer.jvm/blob/master/README.md 
>
> ## tools.analyzer.js https://github.com/clojure/tools.analyzer.js 
>
> tools.analyzer.js is a js-specific tools.analyzer extension, collection 
> of passes and useful functions to deal with analysis of clojurescript 
> code. 
>
> The current release is 0.1.0-beta4. 
>
> The produced AST is not compatible with the one produced by 
> cljs.analyzer even though they are similar as the cljs analyzer heavily 
> influenced the AST format of tools.analyzer. 
> tools.analyzer.js has several advantages over cljs.analyzer: 
>
> * Heavily modular implementation, thanks to the :children-walking based 
>   multi-pass design. 
>
> * U

tools.analyzer[.js/.jvm], tools.emitter.jvm, status report

2014-08-13 Thread Nicola Mometto

As some of you might know, I've been working contiuously on my various
tools.* contrib libraries for the past months and I've recently added
tools.analyzer.js to the list of contrib libraries I maintain.

Since I don't blog/tweet much about those libraries, I thought I'd write
a report to let the community aware of the status of those libraries.

## tools.analyzer https://github.com/clojure/tools.analyzer

tools.analyzer is a host-agnostic pluggable analyzer and collection of
passes producing an AST in clojure data structures for clojure and
other languages in the clojure language family, like clojurescript.

The current release is 0.5.1, here's a list of notable changes that have
made in in the last few months:

* The analyzer now uses different environments for lexical state (like
  the locals map) and for global state (like namespaces mappings); the
  former is just a regular map passed to an analyze call, the latter is
  a dynamic var holding an atom and lives in the tools.analyzer.env
  namespace along with functions to setup/manipulate it.

* The metadata elision mechanism has been vastly improved, allowing to
  specify different keys to elide based on the node :op, aswell as based
  on a predicate rather than simple key matching.

* The env context now partecipates in a keyword hierarchy, the default
  contexts are :ctx/statement, :ctx/return and :ctx/expr and other
  contexts can be derived from those, as an example tools.analyzer
  utilizes :ctx.invoke/target and :ctx.invoke/params for nodes in invoke
  position.

* Dispatch on clojure expressions types has been opened with the
  -analyze-form multimethod, allowing to provide custom evaluation
  strategies for custom types (this was needed for tools.analyzer.js
  because of clojurescript's #js syntax)

* Documentation has been vastly improved with docstrings for every
  public function and pass, and the addition of an official AST
  quickref http://clojure.github.io/tools.analyzer/spec/quickref.html

For a complete list of changes, refer to the CHANGELOG:
https://github.com/clojure/tools.analyzer/blob/master/CHANGELOG.md

For more informations and examples, refer to the README:
https://github.com/clojure/tools.analyzer/blob/master/README.md

## tools.analyzer.jvm https://github.com/clojure/tools.analyzer.jvm

tools.analyzer.jvm is a jvm-specific tools.analyzer extension,
collection of passes and useful functions to deal with analysis of
clojure on the JVM code.

The current release is 0.5.2, here's a list of notable changes that have
made in the last few months:

* Added an analyze-ns function that returns a vector of AST nodes for
  every top-level form in that namespace; evaluates each form.

* Added a configurable handler for wrong tags: while Clojure is
  permissive of type hints that don't resolve to a Class which it
  simply ignores in most cases, tools.analyzer.jvm's default behaviour
  has always been to throw an exception in those cases. This has been a
  longstanding issue for tools like eastwood that want to simply emit a
  warning on those cases rather than stopping analysis and error out.
  With the addition of this handlers, users can now control what happens
  when t.a.jvm hits a tag that can't be resolved to a Class.

* Added optional Var-level tag inference

* Improved analyze+eval to attach the result of the evaluation of the
  node to the AST, wrapping potential exceptions at evaluation time in
  an ExceptionThrown record.

* Documentation has been vastly improved with docstrings for every
  public function and pass, and the addition of an official AST
  quickref http://clojure.github.io/tools.analyzer.jvm/spec/quickref.html

For a complete list of changes, refer to the CHANGELOG:
https://github.com/clojure/tools.analyzer.jvm/blob/master/CHANGELOG.md

For more informations and examples, refer to the README:
https://github.com/clojure/tools.analyzer.jvm/blob/master/README.md

## tools.analyzer.js https://github.com/clojure/tools.analyzer.js

tools.analyzer.js is a js-specific tools.analyzer extension, collection
of passes and useful functions to deal with analysis of clojurescript
code.

The current release is 0.1.0-beta4.

The produced AST is not compatible with the one produced by
cljs.analyzer even though they are similar as the cljs analyzer heavily
influenced the AST format of tools.analyzer.
tools.analyzer.js has several advantages over cljs.analyzer:

* Heavily modular implementation, thanks to the :children-walking based
  multi-pass design.

* Unified AST format and analyzer interface between clj and cljs code
  analyzers, this will allow library authors to write passes that can be
  shared between different analyzers and write code that will work for
  both clj and cljs with only minimal changes.

* Caching of the namespace env: because of its multi-pass nature, t.a.js
  is a bit slower than the (mostly) single-pass cljs.analyzer, to
  compensate for this, t.a.js offers a mechanism of storing on disk &
  reloading the