Do you use extension+English or operator+tuple?

extension Struct: Equatable {}
func ==(left: Struct, right: Struct) -> Bool {
  return left == (right, [
    {$0.a1}, {$0.a2}, {$0.a3}
  ])

  return left.equals(right) {[
    {$0.a1}, {$0.a2}, {$0.a3}
  ]}
}


Sorry, can't past the extension or operator here because it of course requires much emoji.

Replies

What?

You can't use trailing closures with operators so you have to work around it by using tuples to pass in more data. Not that it's likely that we'd define equality with only one property of a struct, but if it were possible, here are the options:

return left.equals(right) {$0.property}
return left == (right, {$0.property})


I'd like it to look like this:

left == right {$0.property}


and I'd also like a variadic for the closures that return Equatables:

return left == right (
  {$0.a1}, {$0.a2}, {$0.a3}
)