Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

half-finished sentence in specification #4980

Closed
scabug opened this issue Sep 8, 2011 · 5 comments
Closed

half-finished sentence in specification #4980

scabug opened this issue Sep 8, 2011 · 5 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Sep 8, 2011

In the Scala Language Specification (the version dated May 24 2011), in section 12.1 "Root Classes", the paragraph explaining how isInstanceOf works when given a type that is a type member of some outer class ends with the following half-sentence: "In other words, an isInstanceOf test does not check for the"

Then it breaks off, and the next paragraph begins. What does an isInstanceOf test not check for? I'd like to find out, because this is a fairly subtle point of the language and I actually can't tell what the rest of the sentence was intended to say. =)

@scabug
Copy link
Author

scabug commented Sep 8, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4980?orig=1
Reporter: Greg Price (price)

@scabug
Copy link
Author

scabug commented Sep 8, 2011

@paulp said:
An isInstanceOf test does not check that types have the same enclosing instance. Here is what it is saying.

class A { 
  class B
  def f(x: Any) = x.isInstanceOf[B]
  def g(x: Any) = x match { case _: B => true ; case _ => false }
}
val a1 = new A
val a2 = new A
val b2 = new a2.B

scala> a1.f(b2)
res0: Boolean = true

scala> a1.g(b2)
res1: Boolean = false

@scabug
Copy link
Author

scabug commented Sep 8, 2011

Greg Price (price) said:
Cool, thanks for the explanation.

Are you able to update the specification to reflect that? (At least for the next version, if you're real conservative about changes.) I'm not sure where the source lives or where the copy on the website (http://www.scala-lang.org/docu/files/ScalaReference.pdf) comes from.

@scabug
Copy link
Author

scabug commented Oct 15, 2013

@gkossakowski said:
Unassigning and rescheduling to M7 as previous deadline was missed.

@scabug
Copy link
Author

scabug commented Mar 12, 2014

@adriaanm said:
Thanks, clarified in upcoming markdown version of the spec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants