Skip to content

std.reflect.Type field kind should be enum #7184

@Chriscbr

Description

@Chriscbr

Use Case

To reduce bugs with writing code that is reflection heavy and dispatches based on what types have been reflected, it would be preferable to restrict the "kind" field to a fixed set of choices.

Example, instead of:

let t = @type(Array<str>);
assert(t.kind == "array");

it can be:

assert(t.kind == std.reflect.TypeId.ARRAY);
// or
assert(t.kind == .ARRAY);

Proposed Solution

No response

Implementation Notes

No response

Component

Compiler, SDK

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
  • If this issue is labeled needs-discussion, it means the spec has not been finalized yet. Please reach out on the #dev channel in the Wing Discord.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions