Skip to content

Dart target: port LINQ runtime (Enumerable, Grouping) to metano_runtime #174

Description

@danfma

Context

The TypeScript runtime (`targets/js/metano-runtime/src/system/linq/`) ships 24 lazy LINQ enumerables (`select`, `where`, `group-by`, `order-by`, `take`/`skip`/`zip`/`union`/etc) plus a `Grouping<K, T>` helper. The Dart runtime (`targets/dart/metano_runtime/`) does not have an equivalent yet — Dart's built-in `Iterable` methods cover only part of the surface, and the parts that diverge (the C# `OrderBy`/`ThenBy` chain, `GroupBy` returning `IGrouping`, the lazy-zip/union semantics) need a real port.

Scope

  • Inventory which LINQ methods can lean on Dart's built-ins (`Iterable.where`/`map`/`fold`/`take`/`skip`) and which need a port.
  • Port the genuinely missing helpers as Dart classes / extension methods on `Iterable`. Match the TS surface so generated code stays portable.
  • Add a `Grouping<K, T>` Dart class implementing `Iterable` and exposing `Key`, mirroring the TS counterpart used by `GroupBy`.
  • Update `IrRuntimeRequirementToDartImport.Map` to surface `Enumerable` / `Grouping` as `metano_runtime` imports.
  • Add Dart-side tests in `targets/dart/metano_runtime/test/` covering deferred execution, grouping ordering, chaining (`OrderBy` → `ThenBy`).

Verification

  • Existing `HashCode` golden tests stay green.
  • New tests cover the behavior the TS port locked in.
  • A future Dart sample exercising LINQ + records (mirror of `SampleIssueTracker`) regenerates and `flutter analyze` clean.

Part of #28

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions