KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In the file Parsers.scala (Scala 2.9.1) from the parser combinators library I seem to have come across a lesser known Scala feature called "lazy arguments". Here's an example: def ~ [U](q: => Parser[U]): Parser[~[T, U]] = { lazy val p = q // lazy argument (for(a <- this; b <- p) yield new ~(a,b)).named("~") } Apparently, there's something going on here with the assignment of the call-by-name argument q to the lazy val p . So far I have not been able to work out what this does and why it's useful. Can anyone help?
Tags (comma-separated)
Save Edits
Cancel