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

Allowed to have case class and explicit (enhanced) companion object?

1 reply
Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.

Hi,

i was wondering... is this problematic (scala 2.8):

object X {
... some functionality ...
}

case class X( a: Int, b: Int )

the netbeans plugin puts an error marker on "object X", saying that X has a duplicate constructor, but in fact scalac compiles without problem, and the code seems to run fine...

it's cool to have the possibility to enhance the companion object of a case class, just want to make sure that this is officially supported...

cheers, -sciss-

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Allowed to have case class and explicit (enhanced) compani
AFAIK, it is supported. As long as I didn't duplicate a method defined by the case class, I never had any trouble with it.

On Tue, Dec 29, 2009 at 10:13 PM, Sciss <contact@sciss.de> wrote:
Hi,

i was wondering... is this problematic (scala 2.8):

object X {
       ... some functionality ...
}

case class X( a: Int, b: Int )

the netbeans plugin puts an error marker on "object X", saying that X has a duplicate constructor, but in fact scalac compiles without problem, and the code seems to run fine...

it's cool to have the possibility to enhance the companion object of a case class, just want to make sure that this is officially supported...

cheers, -sciss-




--
Daniel C. Sobral

I travel to the future all the time.

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