Liufengyun Gestalt Save Abandoned

gestalt : portable and solid macros for Scala

Project README

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

Open Source Agenda is not affiliated with "Liufengyun Gestalt" Project. README Source: liufengyun/gestalt
Stars
31
Open Issues
6
Last Commit
6 years ago

Open Source Agenda Badge

Open Source Agenda Rating