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-1340] Implement SE-0068: Expanding Swift Self to class members and value types #43948

Closed
lattner mannequin opened this issue Apr 28, 2016 · 9 comments
Closed

[SR-1340] Implement SE-0068: Expanding Swift Self to class members and value types #43948

lattner mannequin opened this issue Apr 28, 2016 · 9 comments
Assignees
Labels
compiler The Swift compiler in itself feature A feature request or implementation good first issue Good for newcomers swift evolution implemented Flag → feature: A feature that was approved through the Swift evolution process and implemented type checker Area → compiler: Semantic analysis

Comments

@lattner
Copy link
Mannequin

lattner mannequin commented Apr 28, 2016

Previous ID SR-1340
Radar rdar://problem/17892696
Original Reporter @lattner
Type New Feature
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 14
Component/s Compiler
Labels New Feature, StarterBug
Assignee @slavapestov
Priority Medium

md5: ed5a7fa460047035b11b171886828460

is duplicated by:

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

Issue Description:

"SE-0068: Expanding Swift `Self` to class members and value types" has been accepted:
https://github.com/apple/swift-evolution/blob/master/proposals/0068-universal-self.md

This bug tracks an implementation for it.

@swift-ci
Copy link
Collaborator

swift-ci commented Jun 3, 2016

Comment by Austin Zheng (JIRA)

Given that this is marked as `StarterBug` and the semantics are pretty straightforward, I'd like to try my hand at it.

@swift-ci
Copy link
Collaborator

Comment by Josef Willsher (JIRA)

An initial implementation is in this PR: #3866 – we still need to implement allowing `Self` to refer to the dynamic type of non final classes.

@swift-ci
Copy link
Collaborator

Comment by Austin Zheng (JIRA)

Awesome! Do you mind if I reassign the ticket to you, joewillsher (JIRA User)?

@swift-ci
Copy link
Collaborator

Comment by Josef Willsher (JIRA)

Not at all, thanks

@swift-ci
Copy link
Collaborator

Comment by erica sadun (JIRA)

Since this went to radar, is it totally dead? How did it end up?

@DevAndArtist
Copy link
Mannequin

DevAndArtist mannequin commented Feb 6, 2018

Almost two years have passed, this proposal isn't implemented yet. Hmm.

@swift-ci
Copy link
Collaborator

Comment by Noam Tamim (JIRA)

Is there still a plan to implement this feature? When it was filed, the common "workaround" was self.dynamicType.staticMethod(). In Swift 3, this has been replaced with type(of: self).staticMethod(), which is even more annoying IMHO.
Self.staticMethod() is so obvious in Swift-world that I just typed it, expecting it to work, and was surprised that it doesn't.

@slavapestov
Copy link
Member

Yes, it is still planned. It is a lower priority since it's not ABI, and we need to do some architectural changes to the type system before this feature can make sense for classes.

@johnno1962
Copy link
Contributor

I've put forward a PR that from a functional point of view is a contender to solve this problem even if it isn’t particularly elegant: #22863

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added feature A feature request or implementation type checker Area → compiler: Semantic analysis swift evolution implemented Flag → feature: A feature that was approved through the Swift evolution process and implemented and removed new feature labels Nov 11, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself feature A feature request or implementation good first issue Good for newcomers swift evolution implemented Flag → feature: A feature that was approved through the Swift evolution process and implemented type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants