[swift-users] Mapping C semantics to Swift

Jens Alfke jens at mooseyard.com
Fri May 20 10:55:19 CDT 2016

> On May 20, 2016, at 7:33 AM, Ken Burgett via swift-users <swift-users at swift.org> wrote:
> the required C struct morphs into a Swift class, with a member function 'as_C_byte_array' which answers an array of the required form.  Internally, this function will shift and mask class attributes in order to build the necessary result.

It would be nice to see Swift acquire structured-data I/O APIs as found in languages like Ruby and Python — these take a printf-like format string and parameters, but read and write values in binary. The format syntax offers modifiers to specify things like byte order, string encoding, etc. This is so much more reliable and readable than doing the encoding by hand.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160520/c9aca75f/attachment.html>

More information about the swift-users mailing list