Skip to content

Adopt Auto Lambda syntax in Builder code guidance and Copilot #3451

Description

@nighca

Background

XGo now supports Auto Lambda: classfile commands explicitly opted in through gox.mod can use a trailing block as the final lambda argument without the => boilerplate. For example, onStart { ... } and times 3 { ... } are shorter, equivalent spellings of the existing explicit-lambda forms.

For applicable Builder/SPX commands, this is a clearer and more approachable style for users writing game code. Builder should guide users toward it rather than continuing to foreground the more verbose spelling.

Scope

Adopt Auto Lambda as the preferred example style wherever the command and argument count have been enabled for it.

  • Update Builder-maintained API-reference examples and code snippets.
  • Update editor completion snippets and related code-generation templates.
  • Ensure Copilot understands Auto Lambda, uses it in generated examples when applicable, and encourages the style in its guidance.
  • Audit relevant documentation, tutorials, and built-in skills/prompts for examples that should be migrated.

Constraints

  • Auto Lambda is classfile- and command-specific. Do not suggest it for commands that are not explicitly enabled, or in ordinary non-classfile XGo source.
  • The existing explicit => syntax remains valid and must continue to be supported.
  • Coordinate command eligibility and fixed leading-argument counts with Align SPX event APIs with Auto Lambda fixed argument counts #3400, which tracks the necessary SPX event API alignment.

Acceptance criteria

  • Applicable API-reference and completion snippets prefer the Auto Lambda spelling.
  • Copilot can correctly recognize both spellings and prefers Auto Lambda in new code when the target command supports it.
  • Guidance does not recommend Auto Lambda outside its supported classfile/command scope.
  • Existing explicit-lambda user code remains valid and unchanged unless users choose to rewrite it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions