Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion what is going on on this line?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Diego Medina  
View profile  
 More options Jun 9 2012, 8:02 pm
From: Diego Medina <di...@fmpwizard.com>
Date: Sat, 9 Jun 2012 20:02:48 -0400
Local: Sat, Jun 9 2012 8:02 pm
Subject: [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/b9562ea6bb4ff1164b0d57050...

  /**
  * 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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.