scala-macro-debug icon indicating copy to clipboard operation
scala-macro-debug copied to clipboard

Can you def str(arg) => (arg, String) instead printing?

Open valtih1978 opened this issue 9 years ago • 3 comments

It would be universal solution to stringify a param for later reuse of the string rather than simply println it in the debug.

valtih1978 avatar Dec 27 '15 19:12 valtih1978

Sure you can, should be an easy change - or rather adding another quote method as you suggest in #4. Maybe you'd like to attempt creating a PR?

adamw avatar Dec 28 '15 07:12 adamw

No, I will be happy to install "com.softwaremill.scalamacrodebug" %% "macros" % "0.4" right into my sbt :)

valtih1978 avatar Dec 29 '15 09:12 valtih1978

Know what, QUOTE(expression: ScalaCode => String) is not enough. We still need TITLED(expression: ScalaCode => (String, Expression)) you know because it is the only way to replace

test("integer_literal", integer_literal, 10)
test("integer_literal", integer_literal, 16xAA)

in use with the desired

def test(parserSpec) {
  val parser = parserSpec._2 ; val parserName = parserSpec._1
  ...
  print("parser " + parserName + " produced " + result)
}

test(integer_literal, 10)
test(integer_literal, 16xAA)

valtih1978 avatar Dec 29 '15 23:12 valtih1978