We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It would be very useful if we could we write a macro,
def publish[T](t : T) = macro publishImpl(t) def publishImpl[T](c : Context)(t : c.Expr[T]) = ...
such that when called,
publish("foo")
it expanded at the call site to,
implicit val <freshname> = "foo"
The following implementation suggested by Eugene,
import scala.reflect.makro.Context object Macros { def publish = macro publishImpl def publishImpl(c : Context) = c.reify{implicit val foo: String = "foo"} } import Macros._ object Test extends App { publish; println(implicitly[String]) }
doesn't work "because (as far as I can guess by interpreting the error) macro expansion happens too late to be included in scope".
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-5774?orig=1 Reporter: @milessabin Affected Versions: 2.10.0
Sorry, something went wrong.
@xeno-by said: Very enlightening discussion: http://groups.google.com/group/scala-internals/browse_thread/thread/cef63f151de17494
@xeno-by said: Looks like now that we have working implicit macros, this is no longer necessary.
xeno-by
No branches or pull requests
It would be very useful if we could we write a macro,
such that when called,
publish("foo")
it expanded at the call site to,
The following implementation suggested by Eugene,
doesn't work "because (as far as I can guess by interpreting the error) macro expansion happens too late to be included in scope".
The text was updated successfully, but these errors were encountered: