[Issue 11666] New: Separate each platform's port to its own folder/file: aka "if version{} else version {}" getting out of control

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 2 18:38:07 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11666

           Summary: Separate each platform's port to its own folder/file:
                    aka "if version{} else version {}" getting out of
                    control
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: druntime
        AssignedTo: nobody at puremagic.com
        ReportedBy: slavo5150 at yahoo.com


--- Comment #0 from Mike Franklin <slavo5150 at yahoo.com> 2013-12-02 18:38:00 PST ---
I'm attempting a port of the D Runtime to a new platform, and currently
studying the D Runtime codebase.  I find that the "if version{} else version
{}" is not so eloquently employed, and as the list of D Runtime ports grow,
this is going to get out of control (if it's not already).

Ian Buclaw posted a recommendation here: 
http://forum.dlang.org/thread/fdsovuxnffmnpqhfmpts@forum.dlang.org#post-mailman.1526.1333966829.4860.digitalmars-d:40puremagic.com

Repeated here in case the original gets lost:

** begin quote **
Personally I feel that people porting to specific architectures should
maintain their differences in separate files under a /ports directory
structure - lets say core.stdc.stdio as a cod example. The version for
bionic would be under /ports/bionic/core/stdc/stdio.d, and that is the
module that gets compiled into the library when building for bionic.
When installing, the build process generates a header file of the
bionic version of core.stdc.stdio and puts the file in the correct
/include/core/stdc/stdio.di location.

Though it is fine to say using version {} else version {} else static
assert(false); when dealing with a small set of architectures.  I feel
strongly this is not practical when considering there are 23+
architectures and 12+ platforms that could be in mixed combination.
The result would either be lots of code duplications everywhere, or
just a wiry long block of spaghetti code.  Every port in one file
would (eventually) make it difficult for maintainers IMO.
** end quote **

I'm filing this issue to hopefully bring attention to this and foster gradual
change.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list