Navigation Menu

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-13854] The Initialization chapter in The Swift Programming Language Guide needlessly emphasizes that Swift provides automatic argument labels for initializers #56252

Open
swift-ci opened this issue Nov 13, 2020 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. documentation

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-13854
Radar rdar://problem/71385572
Original Reporter Kentzo (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug, Documentation
Assignee None
Priority Medium

md5: 658f6392f7d6137e4c6e9c22196811ff

Issue Description:

The guide states:

However, initializers do not have an identifying function name before their parentheses in the way that functions and methods do. Therefore, the names and types of an initializer’s parameters play a particularly important role in identifying which initializer should be called. Because of this, Swift provides an automatic argument label for every parameter in an initializer if you don’t provide one.

and

Note that it is not possible to call these initializers without using argument labels. Argument labels must always be used in an initializer if they are defined, and omitting them is a compile-time error:

This is needless as SE-0046 was adopted in Swift 3.0 and thus, unless explicitly stated otherwise, automatic argument labels are default everywhere. That may confuse readers who might assume that labels are not default anywhere but inside init.

@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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. documentation
Projects
None yet
Development

No branches or pull requests

2 participants