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

Re: Re: @specialized and Structural types

No replies
Matt Fowles
Joined: 2009-07-09,
User offline. Last seen 42 years 45 weeks ago.

Josh~

Couldn't you do this by just having two methods:

def apply(A: Closeable) = ...
def apply(A <: { def close() : Unit }) = ...

Then the method resolver would automatically pick the choice of best fit?

Fair warning, I am guessing about the semantics of the scala method resolver based on my knowledge of Java's.

Matt

On Jul 12, 2009 1:29 PM, "Josh Suereth" <joshua.suereth@gmail.com> wrote:

I should mention the desired behavior would be anything that meets the following type A <: Closeable, would use the specialized interface, and anything just meeting A <: { def close() : Unit }, would use the unspecialized interface.  I know there may be other ways to acommplish this, but I still feel @specialized is the way to go.

On Sun, Jul 12, 2009 at 1:01 PM, Josh Suereth <joshua.suereth@gmail.com> wrote: > > Hey All, > > I...

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