Sam Barton wrote:
> So this is like ParseTree for Ruby 1.9? From a practical standpoint
> could you please explain how it differs from ParseTree? I don't care
> about the implementation details.

Short answer:
* use ast_eval instead of eval when ASTs are needed
* use to_ast instead of to_sexp

There is a caveat outlined in the readme, but the situation to which
it applies is rather unusual (code which frequently/continually evals
strings or reloads files without calling to_ast may need a periodic
flush_cache).

Incidentally it is only eval's implicit binding parameter which
prevents a seamless integration with Ruby; hence the ast_eval method.
Unfortunately Ruby has no robust way to handle this case
(Binding.of_caller works but is hobbled).

I debated whether to use to_sexp for the sake of familiarity, however
I wanted to emphasize that LiveAST is a general tool which can hook
into any parser. LiveAST has no business demanding that the parser
return a sexp in particular (hence to_ast).

-- 
Posted via http://www.ruby-forum.com/.