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

Re: lazy vals and public bitmap$n field

1 reply
hseeberger
Joined: 2008-12-27,
User offline. Last seen 1 year 25 weeks ago.
IMHO it would be an important step towards Scala world leadership, if Scala could be used for CDI, because chances are that CDI will be widely adopted in the next couple of years. If you just somehow could make it ...

Heiko


On 22 November 2010 18:47, martin odersky <martin.odersky@epfl.ch> wrote:



-- 
Heiko Seeberger


On Mon, Nov 22, 2010 at 6:29 PM, Paul Phillips <paulp@improving.org> wrote:
On Mon, Nov 22, 2010 at 06:17:53PM +0100, iulian dragos wrote:
> OTOH I don't know if there's any real reason for having them public,
> other than Scala generally having troubles keeping access modifiers in
> check. They're for sure protected in the compiler's mind, so maybe the
> backed could do a better job at emitting them as such (we don't go
> through getters/setters for synthetics, like bitmap fields).

Last I checked (which was like a week ago) scala never emits protected
fields, only private or public.

 if (isConsideredPrivate) ACC_PRIVATE else ACC_PUBLIC,

I'm sure it will be tedious dicey work trying to make it more granular.

Why can't we just emity ACC_PROTECTED for protected access?

Cheers

 -- Martin 



Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Akka - Simpler Scalability, Fault-Tolerance, Concurrency & Remoting through Actors: akkasource.org

hseeberger
Joined: 2008-12-27,
User offline. Last seen 1 year 25 weeks ago.
Re: lazy vals and public bitmap$n field
Kevin,

On 22 November 2010 18:06, Kevin Wright <kev.lee.wright@gmail.com> wrote:

As a workaround... How well does it work if you hide them inside a nested singleton?

class Foo {
  private[this] object Private {
    lazy val x = ...
    lazy val y = ...
  }
  import Private._

  ...

Sorry, no way. I am not talking about one special case, but about lazy vals in general.

Heiko

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