-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Bool toggle proposal #782
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
Bool toggle proposal #782
Conversation
It would be nice for mySwitch.isOn = myVar.prop1.prop2.enabled.toggle() |
@getaaron that would need to be |
I understand why you would want this, but no other mutating method in the
Standard Library does this, so it's not something I'll consider for the
proposal :).
…On Wed, Jan 17, 2018 at 12:53 PM, Aaron Brager ***@***.***> wrote:
It would be nice for toggle() to return the new value, to enable syntax
like:
mySwitch.isOn = myVar.prop1.prop2.enabled.toggle()
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#782 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAVBlNbeHz514y8mdgReqBWJ8KHZS2Zks5tLd8lgaJpZM4RdUIU>
.
--
Chris Eidhof
|
Some thoughts unrelated to the idea but about the proposal text itself: Consider mentioning that prefix In the alternatives section, you could also be more definitive in mentioning that renaming |
Thanks, good suggestions, I'll add this.
…On Sat, Jan 20, 2018 at 9:22 PM, Xiaodi Wu ***@***.***> wrote:
Some thoughts unrelated to the idea but about the proposal text itself:
Consider mentioning that prefix ! and toggled() parallel the API design
for prefix - and negated().
In the alternatives section, you could also be more definitive in
mentioning that renaming ! is of a kind with commonly rejected proposals
to rename ?:, ||, etc.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#782 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAVBpl90wsQCwW45X0BXFS1sOqU1-c8ks5tMkr9gaJpZM4RdUIU>
.
--
Chris Eidhof
|
proposals/nnnn-bool-toggle.md
Outdated
@@ -0,0 +1,74 @@ | |||
# Feature name |
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.
Can we replace "Feature name" with an actual title for this proposal?
@tkremenek thanks, I missed that. Fixed now. |
@chriseidhof FYI, I plan on kicking this review off on Monday |
Is there an implementation PR? |
There wasn't an implementation PR, but there is now: swiftlang/swift#14586 To be improved :) |
* Bool toggle proposal * Suggestions by @xwu * Feature name * Update and rename nnnn-bool-toggle.md to 0199-bool-toggle.md
As the discussion seems to be short, here's the proposal.