buggins / dlangide

D language IDE based on DlangUI
Boost Software License 1.0
454 stars 57 forks source link

Cast loggers to shared for now to make everying build #426

Closed Imperatorn closed 1 year ago

Imperatorn commented 2 years ago

The best commit ever made

GrimMaple commented 2 years ago

Everything builds fine for me. Can you provide more detail on how exactly do you build everything?

NotMichaelChen commented 2 years ago

Not the OP, but running dub build with dmd 2.101.0 in windows gives the following error message:

src\dlangide.d(33,13): Error: none of the overloads of `sharedLog` are callable using argument types `(NullLogger)`
C:\D\dmd2\windows\bin\..\..\src\phobos\std\logger\core.d(1456,26):        Candidates are: `std.logger.core.sharedLog()`
C:\D\dmd2\windows\bin\..\..\src\phobos\std\logger\core.d(1471,16):                        `std.logger.core.sharedLog(shared(Logger) logger)`
Error C:\D\dmd2\windows\bin\dmd.exe failed with exit code 1.

I also get the same error message if I try running dub run --build=release --arch=x86_64 dlangide from the README

GrimMaple commented 2 years ago

Not the OP, but running dub build with dmd 2.101.0 in windows gives the following error message:

src\dlangide.d(33,13): Error: none of the overloads of `sharedLog` are callable using argument types `(NullLogger)`
C:\D\dmd2\windows\bin\..\..\src\phobos\std\logger\core.d(1456,26):        Candidates are: `std.logger.core.sharedLog()`
C:\D\dmd2\windows\bin\..\..\src\phobos\std\logger\core.d(1471,16):                        `std.logger.core.sharedLog(shared(Logger) logger)`
Error C:\D\dmd2\windows\bin\dmd.exe failed with exit code 1.

I also get the same error message if I try running dub run --build=release --arch=x86_64 dlangide from the README

We have discussed this with Imperatron, this is a 2.101 problem. Unfortunately, it's gonna have to wait till I get this compiler version :)

GrimMaple commented 2 years ago

I have investigated the issue a little further, and the provided solution isn't great. It will break compilation on compilers below 2.101, which I don't really want. What I suggest is to extrack this logger creation into a private function, and lock the shared cast behind a static if, like this:

static if (__VERSION__ > 2100)
{
    // create with cast
}
else
{
    // create without cast
}

I think it's also OK to remove the top-level version(Windows), as it's not doing much

GrimMaple commented 2 years ago

Also, before I forget, another bruh momen is that std.experimental.logger is now deprecated, so please static if(__VERSION__ > 2100) that import too. For versions 2.101 onwards, it sohuld import std.logger

GrimMaple commented 1 year ago

Implemented a proper fix, going to close this now