[swift-evolution] Feedback for SE-0004: Remove the ++ and -- operators

Chris Lattner clattner at apple.com
Sun Dec 6 17:06:09 CST 2015


On Dec 6, 2015, at 6:22 AM, David Zarzycki <zarzycki at icloud.com> wrote:
>> That is definitely an interesting idea.  In practice, we won’t be able to remove ++/— from the compiler until the ~Spring 2017 release, since Swift 3 will want to parse the old code and reject it with a fixit hint. 
>> 
>>> Doing so would define away a type checking ambiguity where “let f = T -> T = someOperatorIdentifier” is ambiguous when both prefix and postfix operators exist.
>> 
>> Besides the general simplification potential for the language, is this a theoretical concern or an actual one?  You can currently do something like “let f = T->T = {$0^}” or “{^$0}” to disambiguate the prefix/postfix forms.
> 
> It is just simplification that opens the door to further simplicity and self-consistency within the language. In addition to not needing the above workaround, one could remove the fixity keywords/attributes altogether, because they’d be inferable from context.
> 
> If one wants to go deep down the rabbit hole, one could let developers avoid nested parenthesis and the “spiral call syntax problem” by allowing the language to use the same unary operator in either prefix or postfix positions. For example, instead of “(^(-(~x).a).b).c”, one could write “x~.a-.b^.c” to accomplish the same goal.

Ok, we can consider this when work on the Spring 2017 release is active.

-Chris


More information about the swift-evolution mailing list