[swift-evolution] Postfix operators that start with ? or !

Toni Suter tonisuter at me.com
Tue Nov 1 12:08:07 CDT 2016


Oh, I didn't see that, thanks! I'll write a bug report. 

> Am 01.11.2016 um 17:52 schrieb Alex Martini <amartini at apple.com>:
> 
> 
>> On Nov 1, 2016, at 7:23 AM, Toni Suter via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> In Swift 3, I can declare a postfix operator that starts with a ? or a !, but as far as I can tell, there's no way to actually use such an operator:
>> 
>> I think it would probably be best to disallow postfix operators that start with a question mark or an exclamation mark.
>> At the moment it is possible to declare them, but not to use them. That's not very user-friendly. 
> 
> 
> This looks like a bug — the documentation and the behavior disagree.  The docs say:
> 
>> Although you can define custom operators that contain a question mark (?), they can’t consist of a single question mark character only. Additionally, although operators can contain an exclamation mark (!), postfix operators cannot begin with either a question mark or an exclamation mark.
> 
> https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/LexicalStructure.html#//apple_ref/doc/uid/TP40014097-CH30-ID418
> 



More information about the swift-evolution mailing list