Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inheritance is broken #44

Open
BradleyChatha opened this issue Dec 12, 2020 · 0 comments
Open

Inheritance is broken #44

BradleyChatha opened this issue Dec 12, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@BradleyChatha
Copy link
Owner

(This is assuming that #42 is merged.)

The new infogen package provides the internal getCommandArguments template, which provides an AliasSeq of each symbol within a command that describes a JCLI argument.

Now the issue is, D doesn't like it when symbols of members from different types are together within any form of template.

So, if you take a look at the output for the inheritance example, you can see the AliasSeq contains symbols for both the base type, as well as the type inheriting from the base type, causing the compiler to throw a fit.

The current/old way JCLI handles getting args avoided this issue, as it uses a different method for obtaining these arguments, however it feels like such a ballache to rewrite a rewrite just to work around a language/compiler limitation for a relatively small feature.

Mitigation

I haven't tested this yet, but if one were to use mixin templates and structs in place of base types and inheriting types, it should work?

e.g.

abstract class Base
{
    @CommandNamedArg("v")
    bool verbose;
}

@CommandDefault
final class Comm : Base
{
}

Would become

mixin template Base()
{
    @CommandNamedArg("v")
     bool verbose;
}

@CommandDefault
struct Comm
{
    mixin Base;
}

Although knowing my luck, it'd still complain :(

@BradleyChatha BradleyChatha added the bug Something isn't working label Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant