On Wed, Feb 24, 2010 at 11:53 AM, Malte Schwerhoff <
[email protected]> wrote:
> I am currently working on a research project in the context of my
> Master's at the ETH Zürich. The project's (long-term) goal is to develop
> a contract language (pre-, postconditions, invariants, the usual stuff)
> to be able to verify certain aspects of Scala traits.
>
> For starters, I'd like to exemplify typical patterns (or use-cases) of
> Scala traits. So far I have the "stackable modifications" pattern, the
> "interface enrichment" pattern (both taken from the "Programming in
> Scala" book [1]) and the "functionality extension" "pattern" as
> exemplified in [2] (p. 14, German document).
>
A simple pattern that I see often is hand-coded proxies / direct delegation,
e.g.
trait Store {
def read(key: String): Any
def write(key: String, value: Any): Unit
}
trait ActsLikeStore extends Store {
val store: Store
def read(key: String) = store.read(key)
def write(key: String, value: Any) { store.write(key, value) }
}
I'm curious to hear where in the pattern landscape you'd classify Scala
2.8's collection traits like SeqLike, MapLike and such.
alex
--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.