【问题标题】:Is quasiquote removed from scala 3?quasiquote 是否从 scala 3 中删除?
【发布时间】:2021-04-01 00:18:54
【问题描述】:

我正在阅读 metaprogramming manual on Scala 3 并没有找到我在当前项目中大量使用的 quasiqotes。像这样解构树的替代方法是什么:

def impl(c: blackbox.Context): c.Expr[Unit] = {
    import c.universe._
    
    val someTree = //...
    someTree match {
        case typedef @ q"$mods type $name[..$tparams] >: $low <: $high" =>
            //...
        
    }
}

如何将此类带有树解构的代码移植到 Scala 3?

【问题讨论】:

  • 虽然我没有这个问题的答案而且我自己也很好奇,但 Quill 的作者在github.com/deusaquilus/dotty_test 中做了一项关于将 Quill 宏移植到 Doobie 的研究——也许通过在 IDE 中导入它并阅读当Scala中的元编程方式完全改变时,您可能会发现作者使用了什么样的解决方案。
  • (对不起我之前的评论。我删除了)。如果你在这里问,你可能会有更多的运气:gitter.im/lampepfl/dotty

标签: scala metaprogramming scala-macros scala-3


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-10
    • 2016-10-23
    相关资源
    最近更新 更多