schveiguy / raylib-d

Resurrected copy of onroundit's raylib-d
zlib License
55 stars 14 forks source link

Remove linear mixin #54

Closed schveiguy closed 3 months ago

schveiguy commented 3 months ago

The mixin just obscures what members are on the type, including operator overloads. The mixin also has weird static ifs to prevent overloads on things that it doesn't support, which is exactly backwards.

I'd rather just repeat the correct overloads for each type in the type, not as a template. This also will help IDEs.

Also, zero and one should be enums.

Kapendev commented 3 months ago

Can you explain more how a better solution would look like? Something like this?

struct Vector2 {
    inout T opUnary(string op)() if (op == "+" || op == "-") {
        // ...
    }
    // ...
}
struct Vector3 {
    inout T opUnary(string op)() if (op == "+" || op == "-") {
        // ...
    }
    // ...
}
schveiguy commented 3 months ago

Yes, I want to just replace the mixin with the equivalent code from the operators.