Skip to content

Remove mut and or_default from the language #30

@mjm918

Description

@mjm918

Description

mut and or_default should be removed entirely from the naml language.

mut

  • var is already mutable by default — mut is redundant
  • const is immutable — no need for a mut counterpart
  • Struct method receivers (pub fn (mut self: T)) should always be mutable — mut adds unnecessary ceremony

Related: #26 (var mut should error), #28 (remove mut from receivers)

or_default

This feature should be removed from the language entirely.

Scope

Areas to clean up across the codebase:

  1. Lexer: Remove Keyword::Mut (and Keyword::OrDefault / or_default token if it exists)
  2. Parser: Remove mut handling in parse_var_stmt (statements.rs), parse_receiver (items.rs), and any or_default parsing
  3. AST: Remove mutable field from Receiver, remove any or_default AST nodes
  4. Typechecker: Remove mut/or_default handling, make receivers always mutable
  5. Codegen: Remove any mut/or_default codegen paths
  6. Docs: Update language-reference.md to remove any mut/or_default references
  7. Examples: Remove any usage from example files

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