17. +Scala => symbols
- localization
- natural names
caption = 'hello
implicit def translateSymbol(s: Symbol) = s"${s.name} locale:${self.locale}"
implicit def translateTuple[T](s: (Symbol, T))
(implicit toParams: T => TranslationParams) =
translateSymbol(s._1).format(toParams(s._2).p: _*)
validators += >=(10.0)
def >=[T](bound: T)(implicit ord: Ordering[T]): Option[Any] => Validation = {
import ord._; v => v match {
case Some(v: T) if v >= bound => Valid
case _ => Invalid(Symbol("should be greater %s") -> bound :: Nil)
}
}
18. +Scala => structural types
- navigate in nested objects
val form = new Form {
val beanItem = new BeanItem(model) {
...
form.beanItem.property("progress")
- eliminate dependencies
trait Translation {self: {def locale: Option[Locale]} =>