druntime redesign

Denis Feklushkin feklushkin.denis at gmail.com
Tue Feb 25 00:05:05 UTC 2020


Hi!

This post is inspired by: 
https://forum.dlang.org/thread/scklbdrgjiypknuephfj@forum.dlang.org

On Saturday, 22 February 2020 at 13:20:40 UTC, IGotD- wrote:
> Will there be a future improvement of this so that OS specific 
> support can be moved to separate files and selected on module 
> level instead? For example.
>
> void DSpecificLibraryFunction(...)
> {
>     OSDependentLibraryFunction(...)
> }
>
> so that there are predefined OS specific functions that are 
> selected on module level. Also version() switches where 
> everything is consolidated into one file makes it more 
> difficult to merge.

More specific proposal how to achieve this step by step:

Сommunity may agree to add druntime module "core.sys.abstract" 
and everywhere in druntime code what references to a specific 
OSes and architecures (all these thousands of "version(){} else 
version(){}") will add also obtain code like:

version(Abstract_Platform){ core.sys.abstract.some_call(); }

This "core.sys.abstract" code for every exotic uncommon (or just 
"every"?) platform will be placed outside of druntime "src" dir 
and will be used for compilation only if appropriate compiler 
flag "-I" is set and version=Abstract_Platform is defined.

Then some uncommon platforms can be moved to "abstract" 
implementation (for purpose of code coverage for this new 
"abstract subsystem").

And at next step maybe every platforms can be implemented as 
abstract (and "core.sys.abstract" will be renamed into 
"core.sys").

For me it looks like it can be done gradually and at the same 
time not to break anything.

How do you like this idea? Do you see missings/flaws in it?



More information about the Digitalmars-d mailing list