On Sun, Jul 05, 2009 at 01:11:03PM +0200, Viktor Klang wrote:
> Given the following code, the 2.7.5 Scalac compiler tosses me a fine
> error: "constructor Name cannot be accessed in object ValueTypes1"
Companion objects don't really work if they're not top level.
> Now, since I cannot write: *Some( new T(f) ) *in the apply-method of
> the TypeDefFactory, I see no other solution than modify TypeDefFactory
> so the inheriting class/object has to define a "create" method as so:
class Name private[ValueTypes1] (val value : String)
> Why is "new Name(_)" in the ValueTypes1 scope instead of the Name
> scope?
This is not a scoping issue, but a limitation of access modifiers.
"new Name(_)" means what you want it to mean, it's just locked out.
--
Paul Phillips | Beware of bugs in the above code; I have only
Everyman | proved it correct, not tried it.
Empiricist | -- Knuth
i'll ship a pulp |----------*
http://www.improving.org/paulp/ *----------