[swift-evolution] A path forward on rationalizing unicode identifiers and operators

Mike Kluev mike.kluev at gmail.com
Wed Oct 4 08:12:39 CDT 2017


On 4 October 2017 at 13:41, Alex Blewitt <alblue at apple.com> wrote:

>
> The difference between the & and && operators isn't to do with the
> implicit conversions; it's to do with whether both sides of the expression
> are evaluated or not.
>
> false && system('rm -rf')
>
> You really don't want to do that if both sides are executed ...
>

actually, thanks for bringing this up as it leads up to a question:

how in swift do i define my &&& operator (that i may need for whatever
reason, e.g. logging) that will short-circuit
the calculation of right hand side if the left hand side is false?

infix operator &&&: LogicalConjunctionPrecedence

func &&&(left: Bool, right: Bool) -> Bool {
return left && right
}

as written it doesn't short-circuit. is it possible at all in swift?

Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171004/755f7a05/attachment.html>


More information about the swift-evolution mailing list