Skip to content

Quote evaluation order (debugging) #5434

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

Closed
nicolasstucki opened this issue Nov 13, 2018 · 0 comments
Closed

Quote evaluation order (debugging) #5434

nicolasstucki opened this issue Nov 13, 2018 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

When debugging the following code

import scala.quoted._
object Test {
  def main(args: Array[String]): Unit = {
    implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make

    println("start")

    {
      println("start e")
      val e = '{
        ~{
          println("splice")
          '(3)
        }
      }
      println("end e")
      e.run
    }

    println("end")
  }
}

the output will be

start
start e
end e
splice
end

where the natural order would be

start
start e
splice
end e
end

This makes debugging quite hard. The source of the issue is the laziness of the evaluation of the contents of a quote. Making the evaluation eager fixes this.

@nicolasstucki nicolasstucki self-assigned this Nov 13, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 30, 2019
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 30, 2019
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 31, 2019
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 31, 2019
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 31, 2019
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Aug 1, 2019
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Aug 1, 2019
nicolasstucki added a commit that referenced this issue Aug 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant