3 ms·
Your post is great and provides an elegant solution to the syntactic case for parameters, but it also lacks almost all detail on how this would work in practice
by turndown 2y ago
Your post is great and provides an elegant solution to the syntactic case for parameters, but it also lacks almost all detail on how this would work in practice. Say I’m writing the `void food(char a[..])` function. What are the semantics of this fat pointer type, exactly? How do I access the size? What is the ABI around this like? How is the size set on a fat pointer? It just requires so much extra stuff to get it into proposal shape.
- WalterBright 2y agoThis is all thoroughly implemented in D, so I know it works. It's probably D's most well-liked feature. > semantics Accessing a[i] means i gets checked against the array length, and it's a fatal error if it doesn't. > ABI Same as struct {size_t length; void* ptr;} > size sizeof(a) > length __length(a) or something like that