Skip to content

feat: implement out inline declaration syntax (out value: type) #565

@antonsynd

Description

@antonsynd

Context

The parameter_modifiers.md spec documents out value: int inline declaration syntax at call sites, but it is not yet implemented.

Example:

from system import Int32
if Int32.try_parse("42", out value: int):
    print(value)

Should emit:

if (Int32.TryParse("42", out int value))
{
    Console.WriteLine(value);
}

What's needed

  • Parser: extend ModifiedArgument parsing to handle out identifier: type pattern
  • Semantic: register the new variable in scope, validate type
  • CodeGen: emit out type identifier in C# argument position

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions