This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Usage patterns for Scala traits

4 replies
Malte Schwerhoff
Joined: 2010-02-24,
User offline. Last seen 42 years 45 weeks ago.

Hi everybody,

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).

I already went through a lot of tutorials and small projects and I am
going to have a closer look at the Scala Compiler and at Lift.
However, I would be grateful for any hint where to look for typical
and/or interesting uses of traits. Of course, complete examples are more
than welcome :-)

Best regards
Malte

P.S. I cross-posted this mail to the Lift, Scala and Scala-Users mailing
list. I hope nobody takes offense at this.

[1] http://www.artima.com/shop/programming_in_scala
[2] pp.info.uni-karlsruhe.de/lehre/SS2009/foo/Kapitel14.pdf

Derek Williams
Joined: 2009-06-13,
User offline. Last seen 42 years 45 weeks ago.
Re: Usage patterns for Scala traits
This might be more basic then what you are looking for, but I found Jonas Boner's tutorial for Akka to be the tipping point on how to use traits to allow different configurations for a class. This was an aspect that I didn't properly grasp before. It can be found at: http://jonasboner.com/2010/01/04/introducing-akka.html   Derek
  On Wed, Feb 24, 2010 at 12:54 PM, Malte Schwerhoff <mhslists@schwerhoff.de> wrote:
Hi everybody,

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).

I already went through a lot of tutorials and small projects and I am
going to have a closer look at the Scala Compiler and at Lift.
However, I would be grateful for any hint where to look for typical
and/or interesting uses of traits. Of course, complete examples are more
than welcome :-)

Best regards
Malte

P.S. I cross-posted this mail to the Lift, Scala and Scala-Users mailing
list. I hope nobody takes offense at this.

[1] http://www.artima.com/shop/programming_in_scala
[2] pp.info.uni-karlsruhe.de/lehre/SS2009/foo/Kapitel14.pdf



--
Derek
Derek Williams
Joined: 2009-06-13,
User offline. Last seen 42 years 45 weeks ago.
Re: Usage patterns for Scala traits
This might be more basic then what you are looking for, but I found Jonas Boner's tutorial for Akka to be the tipping point on how to use traits to allow different configurations for a class. This was an aspect that I didn't properly grasp before. It can be found at: http://jonasboner.com/2010/01/04/introducing-akka.html   Derek
  On Wed, Feb 24, 2010 at 12:54 PM, Malte Schwerhoff <mhslists@schwerhoff.de> wrote:
Hi everybody,

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).

I already went through a lot of tutorials and small projects and I am
going to have a closer look at the Scala Compiler and at Lift.
However, I would be grateful for any hint where to look for typical
and/or interesting uses of traits. Of course, complete examples are more
than welcome :-)

Best regards
Malte

P.S. I cross-posted this mail to the Lift, Scala and Scala-Users mailing
list. I hope nobody takes offense at this.

[1] http://www.artima.com/shop/programming_in_scala
[2] pp.info.uni-karlsruhe.de/lehre/SS2009/foo/Kapitel14.pdf



--
Derek
Joshua.Suereth
Joined: 2008-09-02,
User offline. Last seen 32 weeks 5 days ago.
Re: Usage patterns for Scala traits
I tried to collect a few myself back in the day: http://suereth.blogspot.com/2009/02/how-should-traits-in-scala-be-used.html

- Josh

On Wed, Feb 24, 2010 at 2:54 PM, Malte Schwerhoff <mhslists@schwerhoff.de> wrote:
Hi everybody,

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).

I already went through a lot of tutorials and small projects and I am
going to have a closer look at the Scala Compiler and at Lift.
However, I would be grateful for any hint where to look for typical
and/or interesting uses of traits. Of course, complete examples are more
than welcome :-)

Best regards
Malte

P.S. I cross-posted this mail to the Lift, Scala and Scala-Users mailing
list. I hope nobody takes offense at this.

[1] http://www.artima.com/shop/programming_in_scala
[2] pp.info.uni-karlsruhe.de/lehre/SS2009/foo/Kapitel14.pdf

Joshua.Suereth
Joined: 2008-09-02,
User offline. Last seen 32 weeks 5 days ago.
Re: Usage patterns for Scala traits
I tried to collect a few myself back in the day: http://suereth.blogspot.com/2009/02/how-should-traits-in-scala-be-used.html

- Josh

On Wed, Feb 24, 2010 at 2:54 PM, Malte Schwerhoff <mhslists@schwerhoff.de> wrote:
Hi everybody,

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).

I already went through a lot of tutorials and small projects and I am
going to have a closer look at the Scala Compiler and at Lift.
However, I would be grateful for any hint where to look for typical
and/or interesting uses of traits. Of course, complete examples are more
than welcome :-)

Best regards
Malte

P.S. I cross-posted this mail to the Lift, Scala and Scala-Users mailing
list. I hope nobody takes offense at this.

[1] http://www.artima.com/shop/programming_in_scala
[2] pp.info.uni-karlsruhe.de/lehre/SS2009/foo/Kapitel14.pdf

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland