Macros are a brand new feature of Scala 2.10. In the presentation I would like to explain why were they added to the language, show step by step how to write your own simple macro and show some libraries, which already use macros to implement functionalities, which were not possible before.

Macros [1] are one of the new features in Scala 2.10. So far they are marked as experimental, but I think nobody has doubts that they will stay there for good. Introducing macros was quite controversial, as Scala isn't a "lean" language already, but I think it was worth it.

Macro is simply a Scala program, executed at compile-time, which manipulates the AST of our program. While we probably will mostly write macros when creating a library of a framework, rather than in day-to-day work (hopefully!), for sure it is good to know what are the mechanisms behind them.

In the presentation, I would firstly like to show step-by-step how to write a simple macro and how does it work. In the second part I will present libraries, which already use macros (but without implementation details), such as ScalaMock [2], Expecty [3], Slick [4] or my own, MacWire [5].

[1] scalamacros.org/

[2] scalamock.org/

[3] github.com/pniederw/expecty

[4] slick.typesafe.com/

[5] github.com/adamw/macwire

Adam Warski
I am one of the co-founders of SoftwareMill, a company specialising in delivering customised software solutions. I code mostly using Scala and Java. I am involved in a number of open-source projects: as the founder and lead developer of Hibernate Envers, a Hibernate core module providing auditing capabilities, as well as the founder of ElasticMQ, Veripacks and MacWire; and as a contributor to SoftwareMill Bootstrap and xsbt-proguard-plugin.

Apart from writing closed- and open-source software, I am interested in improving the way we use functional and object-oriented programming. When not coding, I enjoy spending time with my family, hiking in the mountains or playing tennis.

My blog: warski.org/blog

Loading more stuff…

Hmm…it looks like things are taking a while to load. Try again?

Loading videos…