Well, the difference is that the compiler could produce a warning or error with 
fixit to indicate the developer that an alternative signature to the originally 
C imported one is available. This way, code ports should gain much readability, 
while not requiring much effort from the developer to make use of the newer 
signature.

El 26 mar 2016, a las 5:53, Brent Royal-Gordon <[email protected]> 
escribió:

>> 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
  • [swift-evolution] Promote... Carlos Rodríguez Domínguez via swift-evolution
    • Re: [swift-evolution... James Campbell via swift-evolution
      • Re: [swift-evolu... Carlos Rodríguez Domínguez via swift-evolution
        • Re: [swift-e... Paul Ossenbruggen via swift-evolution
          • Re: [swi... Carlos Rodríguez Domínguez via swift-evolution
            • [sw... Carlos Rodríguez Domínguez via swift-evolution
              • ... Andrey Tarantsov via swift-evolution
                • ... Carlos Rodríguez Domínguez via swift-evolution
              • ... Brent Royal-Gordon via swift-evolution
                • ... Carlos Rodriguez Dominguez via swift-evolution
                • ... Carlos Rodríguez Domínguez via swift-evolution
                • ... Brent Royal-Gordon via swift-evolution
                • ... Carlos Rodríguez Domínguez via swift-evolution
                • ... Goffredo Marocchi via swift-evolution
                • ... Greg Parker via swift-evolution
              • ... Douglas Gregor via swift-evolution
                • ... Carlos Rodríguez Domínguez via swift-evolution
                • ... Thomas Guthrie via swift-evolution
                • ... Douglas Gregor via swift-evolution
                • ... Carlos Rodríguez Domínguez via swift-evolution

Reply via email to