Skip to content

Addition of features and bug fixes. - #13

Merged
FernandoTheDev merged 1 commit into
masterfrom
dev
Jul 20, 2026
Merged

Addition of features and bug fixes.#13
FernandoTheDev merged 1 commit into
masterfrom
dev

Conversation

@FernandoTheDev

Copy link
Copy Markdown
Owner

Add foreach, negative indexing, and stdlib polish

Language Features

  • foreach statement: Support for value iteration (foreach v; arr), index + value (foreach k, v; arr), and by-reference (foreach &v; arr). Desugars to zero-cost C for loops using __typeof__ for element type inference.
  • Negative indexing in ranges: arr[-3..size] now desugars to arr[size-3..size] at compile time.
  • Multi-variable declarations: int x, y = 2, 7; syntax with arity checking.
  • Polymorphic === operator: Now works with any struct that exposes a cmp method, not just strings.

Type System

  • Contextual reference in type resolver: Enables anon dot syntax (.new(), .{}, .Bar) to work correctly in return statements and function call arguments by tracking the expected type through the call stack.
  • Multi AST node: Handles multi-variable declarations cleanly in the parser pipeline.

Standard Library

  • Renamed delete()free() across HashMap, Array, Slice, String for consistency.
  • Renamed compare()cmp() in Slice for shorter method names.
  • Migrated all stdlib examples to use anon dot syntax (.new(), .of(), .create()).
  • Added std.iterator with generic Iterator<T> struct.

Housekeeping

  • Moved examples/std/examples/stdlib/ for clearer naming.

@FernandoTheDev
FernandoTheDev merged commit f189765 into master Jul 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant