Skip to content

feat: named arguments and named return values awareness #12

Description

@SchoolyB

Summary

Grayscale supports named arguments at call sites (STANDARD.md §7.2.5) and named return values in function signatures (§7.3.4). The LSP has limited or no awareness of either.

Named Arguments

do connect(host string, port int = 8080, verbose bool = false) { }

connect(host: "localhost", verbose: true)  // port uses default
connect("localhost", verbose: true)        // positional + named mix

Rules:

  • Positional arguments must come before named arguments
  • Not supported for builtins or stdlib functions

Named Return Values

do divide(a, b int) -> (quotient int, remainder int) {
    mut quotient int = a / b
    mut remainder int = a % b
    return quotient, remainder
}

Named returns are labels only — they don't implicitly declare variables. Support grouped types.

Scope

  • Recognize name: value syntax in function call arguments
  • Recognize named return value syntax in function signatures
  • Hover docs could show parameter names to help users write named arguments

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