3 ms·
I wonder how feasible it would be to decouple data size from type & overflow semantics, a la this comment: https://news.ycombinator.com/item?id=7103347 https:/
by Solarsail 11y ago
I wonder how feasible it would be to decouple data size from type & overflow semantics, a la this comment:
https://news.ycombinator.com/item?id=7103347 https://news.ycombinator.com/item?id=7103347
- AndyKelley 11y agoThe comment you linked is insightful and the commenter is indeed in the target audience for the language. One point I didn't understand is this: "decoupling of on-the-wire layout from in-memory layout". What does that mean? This is good stuff, and I plan to work on some embedded projects to experience firsthand the needs of this kind of project.
- versteegen 11y agoOn-the-wire refers to serialisation (writing to file or socket). It would be great to be able to specify both in-memory layout and serialised layout: the former typically contains padding, which is a waste of space in the later. There may also be endianness differences, different datatypes, etc. That would remove the need to manually write de/serialisation routines if they should differ.
- chubot 11y agoSo basically capnproto built into the language?
- adrusi 11y agoI think that commenter meant that he wants to be able to separately declare physical and logicical layout of datatypes, and be able to assign multiple physical representations to a single logical representation, for different places they might be stored. I'm not sure how I understand how this would offer a benefit over just explicitly converting between identical logical representations with different physical representations, and it would definitely increase complexity.
- deleted 11y ago[deleted]
- PeCaN 11y agoCorrect me if I'm wrong: Does this mean something like (pseudo-C): struct weird_bit_field { uint8_t x : 32; }; i.e. an 8-bit int that takes 4 bytes of space? Or am I misunderstanding something?