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

Document a few details about class #2174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Morriar
Copy link
Contributor

@Morriar Morriar commented Dec 17, 2024

Following the discussion in #2139 (comment).

Signed-off-by: Alexandre Terrasa <[email protected]>
@ParadoxV5
Copy link
Contributor

class refers to the class itself. From my understanding,

class A
  X: class # A
end
class B < A
  # B::X is of type B
end

I’ve always considered instance and self to be different:

SUBJECT = Object.new
SUBJECT.extend Comparable # i.e., SUBJECT.singleton_class.include Comparable
class Object
  def dup: () -> instance # Object
  def itself: () -> self # Object
end
SUBJECT: Object & Comparable
# SUBJECT.dup    -> Object
# SUBJECT.itself -> Object & Comparable

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

Successfully merging this pull request may close these issues.

2 participants