|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
partially applied classesI am just reading about partially
applied functions. So I wonder if there are partially applied classes too? Scala compiles class Complex(real: Double, imag: Double){ //… } class Real(real: Double) extends Complex(real,0){} But when I create an instance of Real my first guess is that the JVM
would reserve Space for the private imag as well. Right or wrong? Does the
Scala compiler replace the private member by a static final constant? |
|
|
Re: partially applied classes> So I wonder if there
> are partially applied classes too? Nope. > But when I create an instance of Real my first guess is that the JVM would > reserve Space for the private imag as well. Right or wrong? Right. > Does the Scala > compiler replace the private member by a static final constant? Nope. That would mean compiling two versions of all the code in Complex, one using the constant and one using the private member. That would break separate compilation. -- Ricky Clarkson Java and Scala Programmer, AD Holdings +44 1565 770804 Skype: ricky_clarkson Google Talk: ricky.clarkson@... Google Wave: ricky.clarkson@... |
|
|
|
|
|
Re: partially applied classesOn Fri, 2009-11-06 at 11:42 +0000, Ricky Clarkson wrote:
> > But when I create an instance of Real my first guess is that the JVM would > > reserve Space for the private imag as well. Right or wrong? > > Right. Actually there is not enough information in the example to say so. imag could simply be a constructor parameter depending on what happens inside the body of Complex. Best, Ismael |
| Free embeddable forum powered by Nabble | Forum Help |