Why are operators not available as static type members?

Parsing is pretty much the only reason I know of. I think we'd have to always parenthesize it in case someone defines .+ as a postfix operator that applies to types (even though you're supposed to write that Int.self.+), but accepting the parenthesized form seems like it'd be a fairly non-controversial evolution proposal, and it's probably not too hard for someone to implement.

Another possible spelling: Int.`+` and Int.`.+`. I might like this one even better because it doesn't even really need any new rules; it just says it's okay to use backticks with operators in member position, and then you've got an escaped identifier like anywhere else.

16 Likes