On Tuesday, 1 March 2022 at 12:29:56 UTC, Steven Schveighoffer wrote:
On 3/1/22 7:22 AM, meta wrote:
If the type is ``Color`` I think the compiler should allow ``GRAY`` if it is a member of ``Color``, isn't how strong statically typed language should work? I wonder what is the rational against it? How hard would it be to allow it?

The problem is how the original source works.

The only way to define a manifest constant for a struct instance in C is to #define it.

So I'm sure that if raylib could put that inside the `Color` type it would, but it can't.

What a D binding should do is exactly what Mike said -- provide a complete binding as expected, and then add machine-generated nicer APIs.

I actually have an open issue, in case anyone is interested in working on it: https://github.com/schveiguy/raylib-d/issues/8

-Steve

Oh I was talking with regard to D's enum, not about the binding, allowing it via D, would make interfacing with C code easier

    enum Color
    { GRAY }

    void setColor(Color color);

    setColor(GRAY);


Reply via email to