Skip to content

Make constants typed #86

Open
Open
@Grief

Description

@Grief

While it is possible to achieve type safety for constants passed to GL functions, I think it would be a breaking change.

What I ask for is to declare a type, e.g. type GLConst int32 and define constants as

const (
	ACTIVE_ATOMIC_COUNTER_BUFFERS GLConst = 0x92D9
	ACTIVE_ATTRIBUTES             GLConst = 0x8B89
	ACTIVE_ATTRIBUTE_MAX_LENGTH   GLConst = 0x8B8A
        ...
)

Then it would be possible to use stringer to generate the code which would convert a value (returned by gl.GetError, for example) to constant name. I think it would be pretty neat for debugging and exception displaying

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions