- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Re: Re: @specialized and Structural types
Sun, 2009-07-12, 18:39
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...