Skip to content

[Parse] Add an attribute for typeEraser. #29775

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

Merged
merged 1 commit into from
Feb 12, 2020

Conversation

hborla
Copy link
Member

@hborla hborla commented Feb 12, 2020

This will be used for compiler-driven type erasure for dynamic replacement of functions with an opaque return type. For now, just parse the attribute and ignore it.

@hborla hborla requested review from xedin and DougGregor February 12, 2020 00:41
@hborla
Copy link
Member Author

hborla commented Feb 12, 2020

@swift-ci please smoke test

This will be used for compiler-driven type erasure for dynamic
replacement of functions with an opaque return type. For now, just
parse the attribute and ignore it.
@hborla hborla force-pushed the parse-type-eraser-attribute branch from 23ea5e4 to ffba71b Compare February 12, 2020 01:37
@hborla
Copy link
Member Author

hborla commented Feb 12, 2020

@swift-ci please smoke test

@omochi
Copy link
Contributor

omochi commented Feb 12, 2020

Is not spelling typeErasure ?

I found a word type erasure in this document.

Prefixes and Suffixes
Any is used as a prefix to denote "type erasure," e.g. AnySequence wraps any sequence with element type T, conforms to SequenceType itself, and forwards all operations to the wrapped sequence. When handling the wrapper, the specific type of the wrapped sequence is fully hidden.

https://github.com/apple/swift/blob/master/docs/StdlibAPIGuidelines.rst#prefixes-and-suffixes

@hborla
Copy link
Member Author

hborla commented Feb 12, 2020

@omochi The spelling "type eraser" is intentional to describe the type that implements type erasure. For example, the protocol Sequence could specify that its type eraser is AnySequence

@_typeEraser(AnySequence)
protocol Sequence {

@omochi
Copy link
Contributor

omochi commented Feb 12, 2020

@hborla Sorry for my ambiguous sentences.
I talk about spelling is whether erasure or eraser.

@hborla
Copy link
Member Author

hborla commented Feb 12, 2020

@omochi Yes, the spelling is intentional. The type eraser is the type that implements type erasure.

@hborla hborla merged commit 24826e0 into swiftlang:master Feb 12, 2020
@hborla hborla deleted the parse-type-eraser-attribute branch February 12, 2020 17:59
@omochi
Copy link
Contributor

omochi commented Feb 13, 2020

@hborla

The type eraser is the type that implements type erasure.

I finally understand what you say 🙂
Thank you.

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

Successfully merging this pull request may close these issues.

4 participants