liufengyun / gestalt

gestalt : portable and solid macros for Scala
https://github.com/scalacenter/macros
31 stars 3 forks source link

Refactoring to remove path-dependent toolboxes #80

Closed liufengyun closed 7 years ago

liufengyun commented 7 years ago

A huge refactoring so that programmers no longer need to deal with path-dependent types.

liufengyun commented 7 years ago

Construction of trees using DSL is actually comparable to quasiquotes when there are noises (many and/or complex unquotes):

q"${Resolve.map(monad.pos, monad)}[${resTp.toTree}]($fun)"

Resolve.map(monad.pos, monad).appliedToTypes(resTp.toTree).appliedTo(fun)
liufengyun commented 7 years ago

The refactoring now works:

It separates user-side API from compiler-side contract. User-side APIs (scala.gestalt.api) include a lot of helpers, extension classes, etc, they represent the promise of gestalt to programmers. Compiler-side API (scala.gestalt.core) represents the promises that made by the compiler to gestalt.

It removes path-dependent type from Toolbox. The trick #36 is used. The user experience is improved a lot.

liufengyun commented 7 years ago

I also removed newValSymbol from the API, as programmer can use ValDef to create a dummy definition and then get the symbol from it.

liufengyun commented 7 years ago

One pity is that Intellij, like Scalac, seems to unable resolve extractors. It's also unhappy with abstract types inherited by api from Toolbox.

liufengyun commented 7 years ago

@valdisxp1 I merge this for now in order to make another PR. Feel free to raise problems or questions if you find any.