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

Traits & Context/View bounds on Type Parameters?

3 replies
mepcotterell
Joined: 2011-03-17,
User offline. Last seen 40 weeks 6 days ago.

/Hey guys,

I was just wondering why traits don't allow type parameters with
context / view bounds? Does anyone know?

Jason Zaugg
Joined: 2009-05-18,
User offline. Last seen 38 weeks 5 days ago.
Re: Traits & Context/View bounds on Type Parameters?

On Thu, Jun 23, 2011 at 5:08 PM, Michael Cotterell
wrote:
> /Hey guys,
>
> I was just wondering why traits don't allow type parameters with
> context / view bounds? Does anyone know?

Those bounds are desugared to implicit parameters, and traits don't
have a constructor parameter list to add them to.

-jason

mepcotterell
Joined: 2011-03-17,
User offline. Last seen 40 weeks 6 days ago.
Re: Traits & Context/View bounds on Type Parameters?

That makes sense. However, I feel like it would be useful in some cases if they were allowed.

Sent from my Verizon Wireless BlackBerry

-----Original Message-----
From: Jason Zaugg
Sender: scala-language@googlegroups.com
Date: Thu, 23 Jun 2011 17:35:23
To:
Reply-To: scala-language@googlegroups.com
Subject: Re: [scala-language] Traits & Context/View bounds on Type Parameters?

On Thu, Jun 23, 2011 at 5:08 PM, Michael Cotterell
wrote:
> /Hey guys,
>
> I was just wondering why traits don't allow type parameters with
> context / view bounds? Does anyone know?

Those bounds are desugared to implicit parameters, and traits don't
have a constructor parameter list to add them to.

-jason

AlanP
Joined: 2011-05-31,
User offline. Last seen 42 years 45 weeks ago.
Re: Traits & Context/View bounds on Type Parameters?

Michael,

Interesting related discussion that may help you:
http://scala-programming-language.1934581.n4.nabble.com/scala-2-8-type-p...

Rgds,

Alan

On Jun 23, 12:40 pm, mepcotter...@gmail.com wrote:
> That makes sense. However, I feel like it would be useful in some cases if they were allowed.
>
> Sent from my Verizon Wireless BlackBerry
>
>
>
>
>
>
>
> -----Original Message-----
> From: Jason Zaugg
>
> Sender: scala-language@googlegroups.com
> Date: Thu, 23 Jun 2011 17:35:23
> To:
> Reply-To: scala-language@googlegroups.com
> Subject: Re: [scala-language] Traits & Context/View bounds on Type Parameters?
>
> On Thu, Jun 23, 2011 at 5:08 PM, Michael Cotterell
> wrote:
> > /Hey guys,
>
> > I was just wondering why traits don't allow type parameters with
> > context / view bounds? Does anyone know?
>
> Those bounds are desugared to implicit parameters, and traits don't
> have a constructor parameter list to add them to.
>
> -jason

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