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

Why use extends to mix in the first trait, with for all others?

2 replies
hseeberger
Joined: 2008-12-27,
User offline. Last seen 1 year 25 weeks ago.
Hi,
Maybe this has been asked before, then apologize asking once more, but I could not find it in the archives:
Why must we write class C extends T1 with T2 with T3 (with Tn being traits)? 
Why must we use extends for the first trait? Wouldn't it be more intuitive to use with for all traits? Like it happens to be the case for dynamic mixins.
Thank you,
Heiko Seeberger

My job: weiglewilczek.com
My blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Kevin Wright
Joined: 2009-06-09,
User offline. Last seen 49 weeks 3 days ago.
Re: Why use extends to mix in the first trait, with for all ot
Dynamic mixins?I didn't think Scala had such a thing...

2009/12/30 Heiko Seeberger <heiko.seeberger@googlemail.com>
Hi,
Maybe this has been asked before, then apologize asking once more, but I could not find it in the archives:
Why must we write class C extends T1 with T2 with T3 (with Tn being traits)? 
Why must we use extends for the first trait? Wouldn't it be more intuitive to use with for all traits? Like it happens to be the case for dynamic mixins.
Thank you,
Heiko Seeberger

My job: weiglewilczek.com
My blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net



--
Kevin Wright

mail/google talk: kev.lee.wright@googlemail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda

Donna Malayeri
Joined: 2009-10-21,
User offline. Last seen 42 years 45 weeks ago.
Re: Why use extends to mix in the first trait, with for all ot
Think of it as
class C extends (T1 with T2 with T3)

Donna

On Wed, Dec 30, 2009 at 5:33 PM, Heiko Seeberger <heiko.seeberger@googlemail.com> wrote:
Hi,
Maybe this has been asked before, then apologize asking once more, but I could not find it in the archives:
Why must we write class C extends T1 with T2 with T3 (with Tn being traits)? 
Why must we use extends for the first trait? Wouldn't it be more intuitive to use with for all traits? Like it happens to be the case for dynamic mixins.
Thank you,
Heiko Seeberger

My job: weiglewilczek.com
My blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net

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