BradleyChatha / jcli

A CLI framework for D
MIT License
23 stars 4 forks source link

Fix error (#57) #58

Closed lempiji closed 1 year ago

lempiji commented 1 year ago

I encountered an issue with the library after updating the DMD compiler, which seems to be the same problem described in Issue #57. I've spent some time investigating the problem and have come up with a fix that I'd like to propose in a pull request.

Here is a summary of the changes I made:

I believe that my changes can help restore functionality and maintain the library's effectiveness.

AntonC9018 commented 1 year ago

Won't it still work with UDAs if you change ArgFlags to an int in the structs? I don't know what's the issue with the compiler, just thought I'd mention that just in case you had overlooked it as a solution.

lempiji commented 1 year ago

Is it something like this?

    @RequiresAllOf(0b00000001)
    _parseAsFlagBit = 1 << 2,.

This would still compile, but since I don't know which enum it points to, I thought a function that avoids forward reference would be easier to read.

AntonC9018 commented 1 year ago

Is it something like this?

    @RequiresAllOf(0b00000001)
    _parseAsFlagBit = 1 << 2,.

This would still compile, but since I don't know which enum it points to, I thought a function that avoids forward reference would be easier to read.

yeah I meant changing the field of the attribute to an int but still passing in ArgFlags.whatever

deavmi commented 1 year ago

Is this fix almost done?

BradleyChatha commented 1 year ago

Is this fix almost done?

Ah sorry, I was waiting to see if @lempiji had a reply for @AntonC9018 and then kind of forgot about this, my apologies.

I'll give it a tiny bit more time, and if not I'll give Anton's proposed fix a try (less code being changed overall, easy to revert it in the future if the underlying issue gets fixed), and if that doesn't work then we can go with this MR.

deavmi commented 1 year ago

Is this fix almost done?

Ah sorry, I was waiting to see if @lempiji had a reply for @AntonC9018 and then kind of forgot about this, my apologies.

I'll give it a tiny bit more time, and if not I'll give Anton's proposed fix a try (less code being changed overall, easy to revert it in the future if the underlying issue gets fixed), and if that doesn't work then we can go with this MR.

Awesome, thanks Brad!

deavmi commented 1 year ago

I did notice ldc seems to compile it as well :)

BradleyChatha commented 1 year ago

I've opened #61 as an alternative that manages to keep the UDAs in place. Happy to hear thoughts on which one is preferred.

Also just generally I'm sorry it's taken so long for such a small thing to get done; I've been really neglectful of personal projects this entire year.

deavmi commented 1 year ago

I've opened #61 as an alternative that manages to keep the UDAs in place. Happy to hear thoughts on which one is preferred.

Also just generally I'm sorry it's taken so long for such a small thing to get done; I've been really neglectful of personal projects this entire year.

Hey man, no worries - sometimes life gets the best of us, glad the project exists in the first place. It's been such a helping hand in my compiler project to make it usable from the command-line and I must credit you for the great work.

Keep it up! :fireworks:

BradleyChatha commented 1 year ago

Due to lack of discussion on whether this MR or #61 is preferred, I'll be defaulting to this MR as it's not a hacky solution.

deavmi commented 1 year ago

Dankie!

deavmi commented 1 year ago

Should I,for now, use the master version from the repository as no tag-commit is available?

BradleyChatha commented 1 year ago

Ah yeah I did forget to make a tag, and it seems dub is slow to pick up the tag, so I'll press force refresh button and hope it picks it up.

deavmi commented 1 year ago

Ah yeah I did forget to make a tag, and it seems dub is slow to pick up the tag, so I'll press force refresh button and hope it picks it up.

I'll give it a check now on Dub and see what tags I see

deavmi commented 1 year ago

Got 0.25.0-beta.2, gonna take it for a spin now...

deavmi commented 1 year ago

I seem to be getting this error now:

Screenshot from 2023-08-10 22-53-40

Using DMD version:

DMD64 D Compiler v2.105.0
Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved written by Walter Bright
BradleyChatha commented 1 year ago

Ah, I guess the deprecations are errors now: https://github.com/BradleyChatha/jcli/issues/60

Will have a look this weekend... if I don't forget :laughing:

deavmi commented 1 year ago

Ah, I guess the deprecations are errors now: https://github.com/BradleyChatha/jcli/issues/60

Will have a look this weekend... if I don't forget :laughing:

We're playing Whack-a-mole-with-walter 🤣🤣

deavmi commented 1 year ago

Enjoy the weekend!