Skip to content
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

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

Open
valtih1978 opened this issue Dec 27, 2015 · 3 comments
Open

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

valtih1978 opened this issue Dec 27, 2015 · 3 comments

Comments

@valtih1978
Copy link

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

@valtih1978 valtih1978 changed the title Can you make str(arg) => (String, arg) instead Can you make str(arg) => String instead printing? Dec 27, 2015
@valtih1978 valtih1978 changed the title Can you make str(arg) => String instead printing? Can you def str(arg) => String instead printing? Dec 27, 2015
@adamw
Copy link
Owner

adamw commented Dec 28, 2015

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?

@valtih1978
Copy link
Author

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

@valtih1978 valtih1978 changed the title Can you def str(arg) => String instead printing? Can you def str(arg) => (arg, String) instead printing? Dec 29, 2015
@valtih1978
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants