jthomas commented on issue #23: Add Codable Support for Swift 4.x
URL: 
https://github.com/apache/incubator-openwhisk-runtime-swift/pull/23#issuecomment-369995988
 
 
   I've been testing out Codable support from the sample above in my library 
for wrapping Swift actions to produce binaries.
   https://github.com/jthomas/OpenWhiskAction/blob/swift4/Sources/epilogue.swift
   
   It's all working great but I made a few changes to improve the developer 
experience that we'd probably want to include. Here are the things I found....
   
   - Support `@escaping` closures to allow users to use with async calls.
   ```
   func _run_main<In: Codable, Out: Codable>(mainFunction: (In, @escaping 
(Out?, Error?) -> Void) -> Void) {
   }
   ```
   
   This just needs the annotation adding and doesn't affect existing code or 
people who don't use that.
   
   - Improved error handled to give more descriptive messages, e.g.
   
https://github.com/jthomas/OpenWhiskAction/blob/swift4/Sources/epilogue.swift#L84-L93
   
   This helps the user understand when there has been problems using the 
Codable API versus something else.
   
   - Sync method style APIs should probably support throws. This enables uses 
to use normal error handling to surface issues.
   
   I'm away on vacation for a week but will attempt to push a PR when I return.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to