For expresiveness and consistency, it would be nice to use the binarylang's data structure definitions, to define outgoing only data in a network protocol, that does not need to be parsed in any way, just serialized. We can do this, but the object variable still has to be initialized with the values we want, and thus the assertion expressions are just comsetic in this example. I'd like to be able to do something like
let myData = DataObject.initAssertions()
struct(udpTrackerPing, endian = b):
64: connection_id = 0x41727101980
32: action = 0
32: transaction_id = rand(int32)
let ping = UdpTrackerPing(connection_id: 0x41727101980, action: 0, transaction_id: rand(int32))
For expresiveness and consistency, it would be nice to use the binarylang's data structure definitions, to define outgoing only data in a network protocol, that does not need to be parsed in any way, just serialized. We can do this, but the object variable still has to be initialized with the values we want, and thus the assertion expressions are just comsetic in this example. I'd like to be able to do something like