-
Notifications
You must be signed in to change notification settings - Fork 21
resetLocalAttrs does not work with {existential types, unapplySeq, local case classes} #8500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8500?orig=1 |
@retronym said: |
@Atry said (edited on Apr 15, 2014 1:39:47 AM UTC): I considered that the public API in For example, there are two types of macros, untyped macro and typed macro. The typed macro accepts typed trees while the untyped macro accepts untyped tree. But what about the tree the macros produce? Should the output trees be typed or untyped? Furthermore, the public |
@Atry said (edited on Apr 17, 2014 10:22:35 AM UTC): |
@xeno-by said: That's why, as Jason has mentioned in gist comments, we're working on Project Palladium (http://scalareflect.org/), which will provide a metaprogramming foundation independent of scalac with a focus on usability. In Palladium there are no separate notions of typed or untyped trees - they are all just trees and Palladium's macro engine figures out the rest. In the meanwhile, as again Jason has mentioned, the only robust way of dealing with the problem of typed vs untyped trees is the hardcore way of creating symbols and assigning types, i.e. manually doing the work of the typechecker. In 2.10, this requires casts from the public API to compiler internals (scala.reflect.internal.SymbolTable). In 2.11, there's a new c.internal API that exposes required idioms as part of the public API. As for the critique of scala.reflect.internal hacks leaking into the public API, consider that the automatic resetLocalAttrs/typecheck approach (which is exactly what we planned: https://groups.google.com/forum/#!msg/scala-internals/rIyJ4yHdPDU/qS-7DreEbCwJ) is very hard to implement, because typer was never designed with resetAttrs in mind. You've probably already figured this out yourself while submitting the flurry of "resetLocalAttrs doesn't work for this and for that" bugs. Therefore in December 2013, which is when we got to discussing this topic, I had just two options: 1) rush for an automatic untypecheck fix, which given the complexity of the task would provide no guarantees that I would ever make it in time for 2.11.0 code freeze or that I would be able to ensure no regressions in existing macros, 2) codify the hacks in the public API. Option #2 is surely less sexy, but it definitely scales better - it immediately stops people from casting to SymbolTable, which is useful in many ways beyond just the typed/untyped problem + it doesn't prevent us from pursuing and delivering the fix over the course of 2.11.x. Hope this provides some perspective and shows that we do take the issues with the reflection API as seriously as possible within the limits of our resources and deadlines. |
consolidating here:
|
The text was updated successfully, but these errors were encountered: