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

objects overriding things

No replies
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.

(Oops, I just sent this to you with the subject
"scala-internals [at] googlegroups [dot] com", the email competence failure
probably obvious.)

There was this bad bug reported (
https://issues.scala-lang.org/browse/SI-5429 ) which I have fixed but
since I'm messing with matchesType and with what's legal I wanted you
to look at it first.

https://github.com/paulp/scala/compare/master...objects-and-overrides

I can also fix the two tests marked !!! if we can agree that
everything is doing what it should here.

Refresher: five months ago we agreed in principle that one should be
able to override objects and I implemented it right away - it's behind
-Yoverride-objects. While looking at SI-5429, I discovered that in
the course of implementing that, I accidentally made it possible for
objects to override other members. (Importantly, none of this was the
cause of SI-5429, which has been in scala forever.) I think this
should be viewed as a "happy accident" and it's how things should work
anyway (and that is reflected in the test case enclosed in the above.)

But the requirements for objects overriding members should be the same
as those for lazy vals, which would mean that an object can't override
a strict val, but a lazy val can be overridden by an object. That it
doesn't yet happen like that is what the !!! test cases are recording.

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