> `->`, `?` and `!` are used in types, but they are mostly unambiguous in
> expressions.
Sure, but types can appear in the middle of expressions. If we drop the `.self`
requirement, a type name will *be* an expression. I don't think you can just
ignore type names.
> The only use of `!` in expressions can be rewitten as a built-in operator
> function:
> postfix func ! <T> (left: T!) -> T
This doesn't work because you can assign through an `!`. For instance:
numberDictionary[key]! += 1
Once we have inout return values, we might be able to make `!` a normal postfix
operator. (Actually, the same goes for `&`, which just becomes a way to
leverage the implicit `&`ing of operator arguments into an explicit `&`ing.)
> `?` is used in optional method calls:
> a.method?(b)
> A parallel proposal is going to remove such syntax from Swift, so this will
> not be a problem.
`?` is used for a lot more than that in expressions: optional chaining, the
ternary operator, etc. None of them can be expressed as ordinary operators
without significantly expanding operator syntax.
Sorry, I don't think we can make any real progress in this space without
additional language features.
--
Brent Royal-Gordon
Architechies
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution