gestalt : portable and solid macros for Scala
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.
dotty/src/main/scala/gestalt/dotty
macros
project
quasiquotes/src/main/scala/gestalt/quasiquotes
src/main/scala/gestalt
.gitignore
.sbtopts
.travis.yml
README.md
build.sbt

README.md

Gestalt Build Status

An experiment and tutorial on how to create a solid and portable macros system based on solid methodology and principles.

Design Goals:

  • Portable -- better IDE experience, works both in Scala and Dotty
  • Solid -- friendly typing error instead of compiler crashes or hacks
  • Friendly -- no knowledge about compiler internals, no dependent universes

Examples

import scala.gestalt._

object Test {
  def plus(a: Int, b: Int): Int = meta {
    q"$a + $b"
  }
}

Design

  • Only blackbox macros
  • Separation of typed and untyped trees
  • Only inspection of typed trees
  • Only semantic information for typed trees

Philosophy

The design space of a macro system is large. Gestalt aims to be simple, solid and portable for the 80% common use cases.

a ) Assumptions on compiler implementation

  • more assumptions
  • fewer assumptions (✓) : portability & easy implementation

b ) Assumptions on macro usage

  • more assumptions (✓) : focus on 80% common cases, make them easy
  • fewer assumptions

c) Features

  • more features
  • fewer features (✓) : metaprogramming is hard, restrict power, implementation solid

Test

  • sbt macros/test:run

Paper

Gestalt : The Road for Lightweight Portable Macros