- About Scala
- In the Enterprise
- Scala Community
- Language Research
- In the Press
- The Scala Team
- Scala's Prehistory
- Contact Us
- Learning Scala
- Tour of Scala
- Scala API
- Setup & Getting Started
- Programming Guides
- Other Guides
- Code Examples
- Scala Developers
Re: Making the scala compiler smarter about overloaded methods
Tue, 2011-02-08, 14:06
Accidentally went off list. Bringing back.
On Mon, Feb 7, 2011 at 5:49 PM, martin odersky wrote:
> On Mon, Feb 7, 2011 at 11:44 PM, Chirino, Hiram wrote:
>> Seems to me that at since the there is no way for the caller to force
>> a => T type, overloading should consider all => T as being T when
>> comparing the type arguments of an overloaded method for purposes of
>> finding a more specific method.
> There are good reasons why we do not want that. Notably, we want a
> method taking a T to be more specific than a method taking a => T.
> Believe me, it's pretty carefully calibrated.
> -- Martin
Yeah seems delicate. Ok here's my last shot at it then: do in 2
passes, the first
pass does it like it's currently done, and if it's still ambiguous
then do a second pass with the => T to T conversion trick in hopes
that it gives you an un-ambiguous selection.
Should give us the best of both worlds.