Generality creep
Mike Franklin
slavo5150 at yahoo.com
Fri Mar 29 02:47:05 UTC 2019
On Thursday, 28 March 2019 at 20:02:17 UTC, Andrei Alexandrescu
wrote:
>> I'm still wondering, though, how we're going to drop druntime
>> while
>> still maintain backward compatibility. Or how we could skip
>> the startup
>> code that invokes module ctors and packages command-line args
>> into
>> string[]. It would be awesome if we could pull this off, but
>> I don't
>> currently see how we could do it without major breakage.
>
> Compiler flag.
D is so powerful, this can also be done in other ways as well.
As Andrei alluded to in another post, we just need to embrace
addition. Keep the existing logic path in place, and create a
new one that does what we want it to do. With
design-by-introspection, and probably a number of other awesome D
facilities, the correct logic path can be chosen at compile-time
based on what the user has declared in their code.
Another idea is allowing "module inheritance" for lack of a
better term. Users can "inherit" from an "abstract" module but
override the default startup and shutdown logic. Perhaps we
refactor the current logic path to inherit from this "abstract"
module but add all of the existing startup and shutdown
implementation as overrides. The compiler is then modified to
"inherit" from that module by default. Users that don't want the
default can "inherit" from the "abstract" module and provide
their own implementation.
I obviously haven't thought all of this through; I'm just trying
to illustrate D is so powerful that there are other ways to
achieve a similar result without always resorting to compiler
flags, though a compiler flag may be the best option.
Mike
More information about the Digitalmars-d
mailing list