[swift-users] Mapping C semantics to Swift

Ken Burgett kenb at iotone.io
Fri May 20 11:57:10 CDT 2016


On 2016-05-20 08:55, Jens Alfke wrote:
>> 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.
> 
> —Jens
Hi Jens,

I understand the value of strong typing from a runtime point of view, 
but I really miss the quickness and simplicity of writing a class in 
Ruby, where duck-typing is king.
-- 
Ken Burgett
Principal Software Engineer
Email: kenb at iotone.io
Office: 530.693.4449
Mobile: 831.332.6846
URL: www.iotone.co


More information about the swift-users mailing list