-
Notifications
You must be signed in to change notification settings - Fork 21
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
Welcome: operator-based API #65
Conversation
Sources/API/Alias.swift
Outdated
} | ||
|
||
@discardableResult | ||
public func >> (_: Debug.P, target: Any) -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chosen >>
because looks are intuitively like starlight for programmers, and less likely to conflict.
I decided use the custom operator >>>
in finally.
Because the operator >>
has higher precedence than all standard operators, therefore can't apply to any expressions.
0e94589
to
64bd639
Compare
} | ||
|
||
precedencegroup PrintPrecedence { | ||
lowerThan: FunctionArrowPrecedence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has lower precedence than all standard operators in Swift.
https://github.com/apple/swift/blob/e6f8843c701a0ea72ddfe0b5538b815767a4ee5d/stdlib/public/core/Policy.swift#L536-L582
64bd639
to
85b06e0
Compare
85b06e0
to
a8e3fff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙆♂️great!🙆♀️
What the customer needed :)
Reference
https://developer.apple.com/documentation/swift/swift_standard_library/operator_declarations