March 18, 2022

On Friday, 18 March 2022 at 03:24:10 UTC, Era Scarecrow wrote:

>

On Tuesday, 8 March 2022 at 22:28:27 UTC, bauss wrote:

>

What D just needs is a way to specify the entry point, in which it just defaults to the first main function found, but could be any function given.

Which is similar to what Java does.

When i was first learning Java in a company i would make main() and have it run all the unittests of that particular module, then have a different file that actually combined all the tools together to run the program. Though when making the jar I'd specify which one actually was needed. But this was... 10 years ago.

Yeah, it's similar to most other languages that allows it too.

It doesn't make much sense to force an entry point anyway, especially not in D where there is no real entry point anyway, but the compiler already emits a couple of different ones that are platform dependent.

March 20, 2022

On Tuesday, 8 March 2022 at 18:38:47 UTC, Paul Backus wrote:

>

On Tuesday, 8 March 2022 at 17:47:47 UTC, BoQsc wrote:
For example, you could use a [version condition][1]:

module otherprogram;

version (Otherprogram_NoMain)
{
    // no main function
}
else
{
    void main(string[] args)
    {
        // ...
    }
}

// other functions...

There is no need for extra features when there is a version feature in D. Moreover, you can abstract the libraries it depends on, as I did here.

SDB@79

1 2
Next ›   Last »