> As you can observe, that old-style signature is highly error prone, does not
> comply with swift guidelines, it is difficult to understand, etc. My opinion
> is that there should be some syntax to rewrite the signature to avoid those
> issues. For instance, a possible syntax could be:
>
> #mapsignature(socket(_:,_:,_:)->Int32)
> func socket(domain:SocketDomain, type:SocketType, protocol:SocketProtocol) ->
> socket_t? {
> let result = socket(domain.rawValue, type.rawValue, protocol.rawValue)
> if result == -1 {
> return nil
> }
> else{
> return result
> }
> }
What's wrong with just overloading it like this without hiding the original?
That way you can start by directly porting (perhaps even mechanically
converting) the code and later refine it to use the nicer Swift-style overload.
--
Brent Royal-Gordon
Architechies
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution