I’d like to throw an idea in the room and see where this will go.

What if Swift would allow us to create custom infix functions?
Does Swift need to ability of infix functions? 
How powerful can such a feature be?
Pros and cons?

There is a discussion about the `with` statement which we could develop with 
infix functions like so:

infix func with<T: AnyObject>(lhs: T, rhs: @noescape (T) -> Void) {

        rhs(lhs)
}

class A {

        func foo() {}
}

let instance: A = A() with { 

        $0.foo()
}

So what does the Swift community think about that idea?

-- 
Adrian Zubarev
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to