- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
inferring Unit
Mon, 2009-02-23, 01:26
This is relevant to how to fix a bug I'm looking at. Is this behavior correct? It seems wrong to me. I would
think new Foo with no parameters should be an error, not interpreted as passing Unit.
$ scala273
Welcome to Scala version 2.7.3.final (Java HotSpot(TM) Client VM, Java 1.5.0_16).
Type in expressions to have them evaluated.
Type :help for more information.
scala> implicit def u2i(x: Unit): Int = 55
u2i: (Unit)Int
scala> class Foo(val x: Int)
defined class Foo
scala> val y = new Foo
y: Foo = Foo@a6bcec
scala> y.x
res0: Int = 55
On Sun, Feb 22, 2009 at 7:25 PM, Paul Phillips <paulp@improving.org> wrote:
--
http://erikengbrecht.blogspot.com/