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
di...@fmpwizard.com
http://www.fmpwizard.com