Just a demo repo for learning macros
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
macros/src/main/scala/com/imranrashid/oleander/macros
macrotests/src/test/scala/com/imranrashid/oleander/macros
project
sbt
.gitignore
README.md

README.md

This repo is just meant to show some basic macros, with the full setup of how to use them.

These examples go along with this blog post http://imranrashid.com/posts/learning-scala-macros/

It uses scala 2.10.2 + the macro-paradise plugin, along with sbt 0.13.0

Run with sbt/sbt "project macrotests" test

The macros are defined in the macros project, and then they are tested in the macrotests project. They are in separate project because macros must be compiled in a separate compilation from their usage. The examples show :

  • basic creation & usage of macros
  • using macro annotations to modify class definitions
  • using quasi-quotes to simplify macro definitions.
  • using reflection to find methods of a trait