def reify[T](expr: T): Expr[T] = macro ???
This results in sbt recompiling the whole 290 source files upon whitepsace change in Global. Given the fact sbt doesn't track macro usage and it would be be relatively difficult to add that functionality (I don't plan to do that)
This way compiler will know that `u` should be inferred as prefix of `tree` if you don't provide it manually.def transform[[u: api.Universe]](tree: u.Tree): u.Tree = ...We've tried having quasiquotes outside of the cake originally but as it turned out due to poor support of path-dependent types (you have to pass the universe around manually) we got:
1) extremely verbose api with significant amount of boilerplate that just about negated most of the simplicity of the quasiquotes.2) a lot of trouble with casting and making path-dependent prefixes lineup
The situation would change when there is an improvement of handling of path dependent types on Scala side. There was a relevant proposal to introduce double-bracket parameters that will notify compiler that universe is path-dependant prefix that should be inferred by compiler:
Could we factor out quasiquotes (at least macros in them) and reify macro to be defined in a class that is baked into a cake through composition and not inheritance?
I think this is kinda of a poor choice. I like Jason's idea. I also think we should try to add special tracking for macros. That should probably be a top priority given the prevalence of macros everywhere (e.g. Play's JSON support). I'd hate to have people unable to parse their JSON because the macro was not re-run upon change of a class file.... (Perhaps we could validate if the current incremental compiler has issues here first).
The incremental compiler should, ideally, always just be an optimisation over running scalac on all sources. If we lead to incorrect compilations we're only asking to tick of users. I'd rather have the incremental compiler recompile the world for a macro (and make people avoid them if they're so bad) than have stale code and hard-to-track down bugs because the incremental compiler chose speed over correctness.
You mean that users will then have to write `c.something.reify` or put an additional import to use quasiquotes?
As I mentioned, I'm ok with adding a switch (what Jason proposes) as a short term solution but do we agree that introducing more configuration options is not the way to go in general?
And that, if I understand correctly, will allow us to better support incremental compilation when developing scalac, right?
I was asking because it doesn't feel right to sacrifice users' convenience for ours. I think it'd be preferable to explore alternative options.
I don't feel very strongly about reify, because with the arrival of quasiquotes its usefulness is severely limited. However speaking of quasiquotes, writing macros is boilerplatey enough as it is to require users to write an additional import.
However let's first wait for Denys so that he can comment whether it'd be possible to encapsulate quasiquotes one level deeper in global without imposing the import tax.
I find explicit imports to be totally ok. You are explicit on what you depend on which is probably a good idea.
I think this is kinda of a poor choice. I like Jason's idea. I also think we should try to add special tracking for macros. That should probably be a top priority given the prevalence of macros everywhere (e.g. Play's JSON support). I'd hate to have people unable to parse their JSON because the macro was not re-run upon change of a class file.... (Perhaps we could validate if the current incremental compiler has issues here first).
The incremental compiler should, ideally, always just be an optimisation over running scalac on all sources. If we lead to incorrect compilations we're only asking to tick of users. I'd rather have the incremental compiler recompile the world for a macro (and make people avoid them if they're so bad) than have stale code and hard-to-track down bugs because the incremental compiler chose speed over correctness.
On 14 Aug 2013 17:04, "Eugene Burmako" <xen...@gmail.com> wrote:
>
> How do you then distinguish runtime and compile-time qqs?
I don't know ... show me some canonical examples off the two scenarios and I'll see what I can come up with.
Cheers,
Miles
I mean, if "implicit val u: Universe = scala.reflect.runtime.universe" becomes a standard implicit, then what do we do with quasiquotes in macros that require "implicit val u: Universe = c.universe"?