Skip to content

feat: wildcard type (?) and type parameter (<?>) support #6

Description

@SchoolyB

Summary

Grayscale supports wildcard types ? (STANDARD.md §7.9) and type parameters <?> (§7.10) for generic-style functions. The LSP has no awareness of either feature.

Wildcard Types

do identity(x ?) -> ? {
    return x
}

do first(arr [?]) -> ? {
    return arr[0]
}

? is valid only in function parameter types and return types. All ? in a signature bind to the same concrete type.

Type Parameters

do make(T <?>) -> ^? {
    return new(T)
}

mut p = make(Point)  // returns ^Point

<?> allows passing a struct type name as an argument. Cannot mix with value parameters.

Scope

  • Recognize ? as a valid type in function signatures for syntax awareness
  • Recognize <?> parameter syntax
  • Add hover docs explaining both features

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions