0

http://simply.liftweb.net/index-5.4.html describes the LiftWeb REST.

What bothers me is that I can't exactly understand. For example,
case "count" :: Nil JsonGet _

I suspect that there is and implicit conventions from List to some another object, and I've found Get method that seems to accept List and Req type, but how it getting together? Please, help.

Observer
  • 710
  • 10
  • 14
  • possible duplicate of [Explain this pattern matching code](http://stackoverflow.com/questions/4008271/explain-this-pattern-matching-code) – Sean Vieira Jul 15 '15 at 08:55

1 Answers1

2

There actually is no implicit conversion going on here at all - JsonGet is an instance of TestGet, which provides an unapply method that returns an Option[(List[String], Req)]. Scala allows calling unapply as an infix method, so that construct is sugar for:

case JsonGet("cout" :: Nil, _) => // the second argument is the Req instance
Sean Vieira
  • 155,703
  • 32
  • 311
  • 293
  • 1
    thanks. My question doubles http://stackoverflow.com/questions/4008271/explain-this-pattern-matching-code And here is some explanation on the requirement of such extractors http://danielwestheide.com/blog/2012/11/21/the-neophytes-guide-to-scala-part-1-extractors.html – Observer Jul 15 '15 at 08:53