juan_gandhi: (Default)
Juan-Carlos Gandhi ([personal profile] juan_gandhi) wrote2012-05-02 02:34 pm
Entry tags:

yet another scala kitten

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
def retrieveProps(c: Container, file: String) {
  val prop = new {
    def apply(key: String) = c.getPropertyOrFail(key,
      throw new IllegalArgumentException(
         "missing " + key + " in " + file)).getValue
  }

  val name = prop("username")
  val pass = prop("password")
  val db   = prop("database")
}

[identity profile] lomeo.livejournal.com 2012-05-03 07:06 am (UTC)(link)
Честно говоря, не вижу как прототипы типизировать. С остальным понятно.

[identity profile] ivan-gandhi.livejournal.com 2012-05-03 04:43 pm (UTC)(link)
А! Прототипы! Я их не использую никогда, так что у меня несколько кособокий взгляд.