druntime redesign
Denis Feklushkin
feklushkin.denis at gmail.com
Wed May 6 11:42:15 UTC 2020
On Saturday, 2 May 2020 at 20:24:46 UTC, IGotD- wrote:
> Trying to adapt druntime has been a cascade of version (this)
> {} else version (that). druntime and phobos is a ball of wool.
This fork of ldc version of druntime is close to success:
https://github.com/denizzzka/druntime/tree/non_posix
Not so much has been added there (look at the diff between ldc
and this branch).
> The situation is similar to the C library which also might have
> dependencies all over. Some C library implementations are more
> simple and OS support can be stubbed. What D needs is a stubbed
> ABI for druntime/phobos. This means no file support, no
> threading etc. This ties into the "pay as you go" goal of D. D
> should be able to compile with minimal OS support instead of
> now require a rich OS.
It is important to understand that libc library is not actually a
library for use C language.
Yes, it contains some C string and math functions, but OS API
functions what provided by libc is convient wrapper for OS
syscalls what used by everyone, because no one wants to support
all number of OSes syscalls.
So, libc de facto is OS API.
It would be great to replace them. But this does not look as a
priority, because you can always use parts of any libc as a
static library for baremetal.
Perhaps it is better to wait for the "worldwide libc replacement"
to appear? Personally, I don't like the concept of errno in libc.
> We should also try to isolate the OS independent functionality
> more. Convenience functions that doesn't need an OS should be
> broken out, or at least with switches be compiled isolated from
> the OS dependent code.
$ grep -r " core.stdc" --include='*.d' druntime/src/core/ |grep
import
displays that at least druntime contains not so much number of
libc calls.
More information about the Digitalmars-d
mailing list