News for hackers. Stuff that matters.
Re:Scala vs Go by mark242 on Tuesday February 14, 2017 @11:49AM (#13644872)
It's okay, since cookies is a Map[String, String] so running the get returns an Option[String].

If the author is concerned, the way to express this to be more expressive could be something like this:

    val uidOpt: Option[Long] = request.cookies.get("uid") map {
        case Some(uidStr) if uidStr.toLong > 0 => Some(uidStr.toLong)
        case _ => None
    }

There are no comments on this comment yet.