Kprchbliuku1qt4mrxap
SkillsCast

Meta-program and/or shapeless all the things!

6th December 2016 in London at CodeNode

This SkillsCast was filmed at Meta-program and/or shapeless all the things!

Metaprogramming using Scala macros is a powerful tool for code generation, automatic optimisation and static checking for improved safety. But macros can look quite scary the first time you see them, so I'll try to convince you that there is nothing to fear. Macros are both useful and fun!

The talk will be in three parts.

Part 1 will be an introduction to Scala macros, using live coding to demonstrate how they work and what you can do with them. We'll look at examples of implementing both a "def macro" and a macro annotation.

In Part 2 I will introduce scala.meta, the next generation of metaprogramming in Scala. I'll demonstrate the syntactic API and "meta paradise", the shiny replacement for the current Scala macro API. With more live coding, I'll show how to re-implement the macro annotation from Part 1 using meta paradise.

Finally in Part 3 I'll talk about when you should NOT use a macro because it would replicate functionality already available in Miles Sabin's shapeless library. I'll introduce a few examples of how to use shapeless to achieve the same result as writing a macro, but with less effort.

Thanks to our sponsors

Meta-program and/or shapeless all the things!

Chris Birchall

Chris is a principal software developer at OVO Energy, where he looks after authentication and personal data as a member of the Identity team. He is the author of the ScalaCache library. He has been using Scala for work and play since 2010.

SkillsCast

Metaprogramming using Scala macros is a powerful tool for code generation, automatic optimisation and static checking for improved safety. But macros can look quite scary the first time you see them, so I'll try to convince you that there is nothing to fear. Macros are both useful and fun!

The talk will be in three parts.

Part 1 will be an introduction to Scala macros, using live coding to demonstrate how they work and what you can do with them. We'll look at examples of implementing both a "def macro" and a macro annotation.

In Part 2 I will introduce scala.meta, the next generation of metaprogramming in Scala. I'll demonstrate the syntactic API and "meta paradise", the shiny replacement for the current Scala macro API. With more live coding, I'll show how to re-implement the macro annotation from Part 1 using meta paradise.

Finally in Part 3 I'll talk about when you should NOT use a macro because it would replicate functionality already available in Miles Sabin's shapeless library. I'll introduce a few examples of how to use shapeless to achieve the same result as writing a macro, but with less effort.

Thanks to our sponsors

About the Speaker

Meta-program and/or shapeless all the things!

Chris Birchall

Chris is a principal software developer at OVO Energy, where he looks after authentication and personal data as a member of the Identity team. He is the author of the ScalaCache library. He has been using Scala for work and play since 2010.