DMD as cross-compiler
doob at me.com
Sat Nov 14 19:19:02 UTC 2020
On Friday, 13 November 2020 at 03:33:05 UTC, Walter Bright wrote:
> On 11/12/2020 11:15 AM, Jacob Carlborg wrote:
>> Implementing druntime and Phobos without the C standard
>> library will give a big opportunity to do things better.
> How so? (Not that you're wrong, I'm just genuinely curious.)
It might not necessary mean a better or different API for Phobos.
But the lower level APIs could be better.
Classic examples are:
* Use arrays instead of pointers (or pointer length pair).
`memcpy` would be:
void memcpy(void source, void destination); // I think it's
more natural to pass the source first
* Better error handling. I think returning error codes or using
`errno` is pretty bad error handling strategy. Even though
exceptions might not be the right choice (unless something like
this is used ), something like returning: `Result!(Value,
Error)` might be better.
* No global symbols, i.e. not having to worry about conflicting
names across multiple files
In short, all the reasons for which you created D in the first
Unfortunately there will still be some limitations due to how the
kernel APIs use pointers and error codes/errno.
More information about the Digitalmars-d