4 ms·
> Not sure what you're thinking, since it does not require templates or generics, and works for the general case. I know it does, because I implemented it for D
by sjmulder 9y ago
> Not sure what you're thinking, since it does not require templates or generics, and works for the general case. I know it does, because I implemented it for D without generics or templates.
This was in favour of your proposal, about how it isn't currently possible to implement this construct generically as a user of the language, hence, it would need to be implemented in the language itself.
I think I do see the point you're trying to make. However:
> Even tiny bits of syntactic sugar, which is what this is, can have dramatic and transformative effects.
This is true, but its use would come mainly from bounds checking at compile time and runtime (otherwise it's just the struct) which is hardly even done for regular arrays.
- WalterBright 9y ago> its use would come mainly from bounds checking That is where the memory safety comes from. But the use comes from things like: 1. strlen, strcat, etc., become obsolete, replaced by far more efficient code 2. looping over an array contents becomes straightforward 3. documenting the extra variable holding the dimension of the array becomes unnecessary I.e. a host of benefits.