2 ms·
Thank you. I'm always pleased when I get a reply from WalterBright[1]. Some follow up questions: 1. If you could redesign the above mechanism, would you do an
by lelanthran 4y ago
Thank you. I'm always pleased when I get a reply from WalterBright[1].
Some follow up questions:
1. If you could redesign the above mechanism, would you do anything differently?
2. In my Own Toy Language[2], I've toyed with the idea making all native arrays fat objects as it seems the best way to ensure that the compiler, at any point, as the ability to bounds check if necessary. All that goes out the window when you want to do FFI to some C function. Any thoughts on mitigating this?
[1] Sorta like telling people when you speak to some celebrity :-)
[2] Everyone designs their own perfect language; I'm no different.
- WalterBright 4y ago> If you could redesign the above mechanism, would you do anything differently? Nope. It was a home run. > All that goes out the window when you want to do FFI to some C function. And there you go! What D does, though, is bounds check the conversion of an array to a pointer, and then (in code marked @safe) not allow arithmetic on the pointer. Additionally, D introduced the `ref` parameter which eliminates nearly all use cases of needing to pass by pointer to a function.