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

dsl: add Type.OfKind method #332

Merged
merged 1 commit into from
Jan 1, 2022
Merged

dsl: add Type.OfKind method #332

merged 1 commit into from
Jan 1, 2022

Conversation

quasilyte
Copy link
Owner

This allows a more concise and efficient checking for
numeric type ranges.

For instance, these are identical in semantics:

        Type.Is("int") || Type.Is("int8") || Type.Is("int16") ||
                Type.Is("int32") || Type.Is("int64")
        =
        Type.OfKind("int")

        Type.Is("uint") || Type.Is("uint8") || Type.Is("uint16") ||
                Type.Is("uint32") || Type.Is("uint64")
        =
        Type.OfKind("uint")

There are other useful kinds like "numeric", "signed", "unsigned", etc.

This allows a more concise and efficient checking for
numeric type ranges.

For instance, these are identical in semantics:

```
        Type.Is("int") || Type.Is("int8") || Type.Is("int16") ||
                Type.Is("int32") || Type.Is("int64")
        =
        Type.OfKind("int")

        Type.Is("uint") || Type.Is("uint8") || Type.Is("uint16") ||
                Type.Is("uint32") || Type.Is("uint64")
        =
        Type.OfKind("uint")
```

There are other useful kinds like "numeric", "signed", "unsigned", etc.
@quasilyte quasilyte merged commit ad12d15 into master Jan 1, 2022
@quasilyte quasilyte deleted the quasilyte/dsl_add_ofkind branch January 1, 2022 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant