-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
compilerThe Swift compiler itselfThe Swift compiler itselffeatureA feature request or implementationA feature request or implementationimprovement
Description
| Previous ID | SR-8278 |
| Radar | None |
| Original Reporter | revolucent (JIRA User) |
| Type | Improvement |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Improvement, LanguageFeatureRequest |
| Assignee | None |
| Priority | Medium |
md5: c6afa3d80664e636a7dd953616f58088
relates to:
- SR-895 Cannot do a qualified import of an operator
- TF-1065 Consider disallowing qualified operators in
@transpose
Issue Description:
I propose to borrow Haskell's syntax for operator disambiguation when the same operator is declared in two different modules and the compiler cannot figure out which one to use contextually. Given the made-up operator %! occurring in modules Foo and Bar, we could say
import Foo
import Bar
let x = 3 (Foo.%!) 4
let y = 17 (Bar.%!) 99Perhaps in Swift the parentheses are not necessary.
The general workaround for this is that there should be an "ordinary" function declared for every operator, so that it can be used in places where the compiler gets confused. This is the practice I follow, but being able to disambiguate operators in this way would be very useful.
Metadata
Metadata
Assignees
Labels
compilerThe Swift compiler itselfThe Swift compiler itselffeatureA feature request or implementationA feature request or implementationimprovement