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

[SR-4707] There should be a way to access static members of Self from instance methods without full qualification #47284

Closed
dabrahams opened this issue Apr 26, 2017 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@dabrahams
Copy link
Collaborator

Previous ID SR-4707
Radar rdar://problem/31838977
Original Reporter @dabrahams
Type Bug
Status Closed
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 16fcb8dbbd0f5eca55c98c2557fa808a

duplicates:

  • SR-1340 Implement SE-0068: Expanding Swift Self to class members and value types

Issue Description:

This is annoying:

struct AThingWithAVeryDescriptiveName {
  static func helper() { ... }
  func f() {
    AThingWithAVeryDescriptiveName.helper() // qualification is needed to avoid an error
  }
}

It sometimes drives me to make things instance methods even when they don't need access to an instance, just to avoid the verbosity. There should be a terse way to get at the static members of Self.

@dabrahams
Copy link
Collaborator Author

@swift-ci create

@belkadan
Copy link
Contributor

type(of: self)

@belkadan
Copy link
Contributor

Also Self, once we implement that.

@dabrahams
Copy link
Collaborator Author

The first is not terse enough. The second might be. I don't know if this is really a dup, but OK, I'll close it.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants