Skip to content

Add documentation and small improvements to core:container/topological_sort - #7081

Open
thetarnav wants to merge 5 commits into
odin-lang:masterfrom
thetarnav:topological_sort_doc
Open

Add documentation and small improvements to core:container/topological_sort#7081
thetarnav wants to merge 5 commits into
odin-lang:masterfrom
thetarnav:topological_sort_doc

Conversation

@thetarnav

@thetarnav thetarnav commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

I've used the topological sort package recently and noticed that it doesn't follow the same "quality" as other and newer packages.
This PR:

  • adds small docs for each procedure
  • adds doc.odin file with a small usage example
  • Reuses Sorter.relations.allocator for allocating Relations.dependents map instead of storing additional allocator in Sorter
  • Adds allocator := context.allocator param to init and sort
  • Adds err: runtime.Allocator_Error result to sort
  • Returns slices from sort instead of dynamic arrays
  • Allocates a single continuous buffer for sorted and cycled slices instead of having two separate dynamic arrays
  • Uses @require instead of _ :: pkg
  • Adds require_results attr to sort

The change should be mostly backwards compatible with the exception of added err: runtime.Allocator_Error result which needs to be handled.

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