10 Jun 2012 02:02
[Lift] [Hoisted] what is going on on this line?
Hi, (a bit off topic, sorry about that) I was looking over the Hoisted code and I found this: https://github.com/fmpwizard/hoisted/commit/b9562ea6bb4ff1164b0d570507ae317c919567f4#L5R145 /** * Compute the title of the file */ def computeTitle: (ParsedFile) => String = pf => { pf match { case md: ParsedFile with HasMetaData => md.findData(TitleKey).flatMap(_.asString) or pf.findData(LinkKey).flatMap(_.asString) openOr computeTitleFromFileName(pf) case _ => computeTitleFromFileName(pf) } } This is the first time I see a pattern math like: case md: ParsedFile with HasMetaData => I thought that what is checking there is that is pf is of type ParsedFile but it also has to extend HasMetaData, is that the case? I tried replicating it on the REPL but I get code cannot be reached for anything that I put as a second match. (But maybe it is just a REPL limitation) Thanks Diego -- Diego Medina Lift/Scala Developer diego@... http://www.fmpwizard.com -- -- Lift, the simply functional web framework: http://liftweb.net Code: http://github.com/lift Discussion: http://groups.google.com/group/liftweb Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
RSS Feed