From: Sam Barton Date: 2011-02-22T20:28:17+09:00 Subject: Re: LiveAST: a pure Ruby 1.9.2 library for obtaining live abstract syntax trees Marc Heiler wrote in post #982809: > Hello, > > Can someone explain to me what one could do with this? > > It sounds very useful to be able and access the ASTs of methods and so > forth, I am just not completely sure what I can do with this new > information afterwards. My favorite example is transforming db.select { |job, city| job == "spelunker" and city == "Miami" } into a database query. The ruby code you see does not actually execute -- some generated code does instead. Ruby syntax is transformed into SQL syntax. Syntax abstraction is very powerful and has thousands of uses, and though it is normally a lisp thing, any language can do it with sexp tools. There are some grumps out there who tut-tut these approaches -- they want nothing beyond a certain level of abstraction. "No, no, no!" they say when they encounter anything Lisp-like. Can't you see them wagging their fingers at us now? -- Posted via http://www.ruby-forum.com/.