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-11885] Allow operator functions to have extra arguments with default values #54301

Open
CodaFi opened this issue Dec 2, 2019 · 1 comment
Open

Comments

@CodaFi
Copy link
Member

@CodaFi CodaFi commented Dec 2, 2019

Previous ID SR-11885
Radar rdar://problem/57711758
Original Reporter @CodaFi
Type New Feature
Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels New Feature, LanguageFeatureRequest, StarterBug, StarterProposal
Assignee mininny (JIRA)
Priority Medium

md5: 210d53f6b32e8240f74a2e7677a3c698

Issue Description:

It might make sense to allow operators to have default arguments, and for those defaults to not count towards the overall arity of the operator. For example, a custom operator `<-` could have `#line` and `#file` defaults in a debug configuration. It could then check some extra invariants in a particular configuration, or do some error reporting, etc.

infix operator <-
// Still infix because it has 2 formal arguments and 1 default
public func <- (lhs: T, rhs :T, file: StaticString = #file) -> U { /**/ }

This change requires an evolution proposal.

@beccadax
Copy link
Contributor

@beccadax beccadax commented Dec 6, 2019

@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
Projects
None yet
Development

No branches or pull requests

2 participants