Skip to content

std: remove the snake_case twins of PascalCase functions (phase 2, step 4) - #3541

Merged
BaseMax merged 9 commits into
mainfrom
p2/delete-snake-twins
Nov 17, 2026
Merged

BaseMax merged 9 commits into
mainfrom
p2/delete-snake-twins

Conversation

@BaseMax

@BaseMax BaseMax commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Phase 2, step 4 of 4. Deletes 431 public std functions whose body only forwards to their PascalCase twin (put/Put, with_path/WithPath, and so on). The compiler looks up some names literally, so those twins stay: the each-loop and ownership protocols, the intrinsic method table, and every name an interface in std declares in either spelling (a struct is checked against an interface by exact name, so forward, handle_event, focusable, close, next and the like must keep existing). The snake_case functions that hold the real implementation stay too. Where a deleted twin carried the only Persian name, its @fa line moves to the PascalCase function (19 cases); the std coverage baseline drops the 19 gaps that closes.

Depends on the other three PRs. Merge order: step 1 (seed bump to 0.6.16), step 2 (call sites to PascalCase), step 3 (fallback for the other spelling), then this one, rebased on main after each lands. On its own this branch does not build with 0.6.16 because the remaining snake_case call sites in std are still there until step 2 lands, so its checks stay red until then.

Checked on a local merge of steps 2, 3 and 4 with the released 0.6.16 compiler as the only seed:

  • stage 1: 0.6.16 builds the tree; stage 2: stage 1 builds it again; the result runs a program
  • error counts of all 206 std packages match the baseline, none worse
  • the compiler closure checks clean for wasm, Windows x64/i686/arm64, macOS x64/arm64 and musl x64/aarch64/i686/armhf
  • check-fa-names, check-naming and check-std-coverage-docs pass (no new gaps)
  • 728 test files compile the same as before (6 better, none worse)
  • 1,143 English website examples: 7 got worse with the first version of this change (structs no longer satisfying nn and tui interfaces), which is why interface names are kept; all 7 compile now. The 4 others that differ are the newer shadow layout rule in current main, not this change.

Summary by CodeRabbit

  • API Changes
    • Removed numerous lowercase, snake_case aliases across the standard library. The corresponding PascalCase methods remain available; update calls to use those names.
    • The removed aliases affected AI/ML, collections, core types, data and file handling, graphs, matrices, OpenCV, and terminal UI APIs.
    • Added Persian-language annotations to selected AI/ML method declarations.

Deletes 600 public functions whose body only forwards to their PascalCase twin (put/Put, with_path/WithPath, and so on). Names the compiler looks up literally (the each-loop and ownership protocols, the intrinsic method table) are kept, as are the snake_case functions that hold the real implementation. Where the deleted twin carried the only Persian name, the @fa line moves to the PascalCase function (24 of them).
The 24 no-fa-name entries for ai/ml methods are covered now that the @fa line of each deleted twin sits on its PascalCase function. Pruned with the tool's own prune mode.
@vercel

vercel Bot commented Nov 16, 2026

Copy link
Copy Markdown

Deployment failed for project salam with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/salamlang?upgradeToPro=build-rate-limit

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

This change removes many public lowercase forwarding aliases across the standard library while retaining most corresponding PascalCase methods. It also adds Persian annotations to selected AI/ML methods and updates the related coverage baseline.

Changes: Standard-library API consolidation

Layer / File(s) Summary
AI and model APIs
std/ai/*
Removes lowercase forwarding methods across AI APIs. Adds Persian annotations to selected AI/ML methods.
Core, collections, and data APIs
std/core/*, std/collections/*, std/data/*, std/encoding/xml/*, std/layoutgen/*
Removes lowercase aliases from core types, collections, datasets, CSV tables, XPath variables, and the Jalali date wrapper.
Numerical and graph APIs
std/bigint/*, std/graph/*, std/matrix/*, std/npy/*, std/time/*
Removes lowercase forwarding aliases from numerical, graph, random-number, and duration APIs.
Spreadsheet and image APIs
std/excel/*, std/opencv/*
Removes lowercase forwarding methods from Excel and OpenCV APIs.
Terminal UI APIs
std/tui/*
Removes lowercase forwarding methods from TUI APIs. In Rect, uppercase methods still call several removed lowercase methods.
Persian annotation baseline
tools/salam/std-coverage-docs-baseline.txt
Removes selected no-fa-name entries for AI/ML methods and Adam.Step.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Possibly related PRs

  • SalamLang/Salam#3251: Adds PascalCase APIs alongside snake_case aliases in overlapping std/tui and std/ai modules.
  • SalamLang/Salam#3312: Adds PascalCase public methods while retaining snake_case forwarding aliases, the pattern removed here.

Suggested reviewers: bdadmehr0, erfangnu

Merge Risk: Minimal · up to dbe65

This change removes redundant lowercase forwarding aliases from the standard library and keeps the PascalCase methods. No concrete breakage was found in the repository. Code outside the standard library that still calls the removed lowercase names would need updating.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: removing snake_case twin functions in the std library, which matches the raw summary and objectives. It is specific and concise. It also names the phase and step, whic…
Description check Passed The description follows the repository template in structure and covers the key sections in substance. It explains the change (deletion of 431 forwarding functions), the reasons for keeping certain na…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: removing snake_case twin functions in the std library, which matches the raw summary and objectives. It is specific and concise. It also names the phase and step, which is project-specific context but does not make the title misleading.

Full details: Description check

Explanation

The description follows the repository template in structure and covers the key sections in substance. It explains the change (deletion of 431 forwarding functions), the reasons for keeping certain names, the merge order and dependencies, and detailed testing results. The template's checklist and Related Issue section are not filled in. The description also does not show a sample test command. These gaps are non-critical, so the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: abeee716-c99e-4ca1-89e0-c5c28aaaff04
Commits

Reviewing files that changed from the base of the PR and between d255af7 and dbe65a5.

Files selected for processing: 68

  • std/ai/autograd/autograd.salam
  • std/ai/gguf/gguf.salam
  • std/ai/ml/ml_bayes.salam
  • std/ai/ml/ml_boost.salam
  • std/ai/ml/ml_cluster.salam
  • std/ai/ml/ml_cluster2.salam
  • std/ai/ml/ml_decomp.salam
  • std/ai/ml/ml_discriminant.salam
  • std/ai/ml/ml_linear.salam
  • std/ai/ml/ml_neighbors.salam
  • std/ai/ml/ml_prep.salam
  • std/ai/ml/ml_svm.salam
  • std/ai/onnx/onnx.salam
  • std/ai/optim/opt_adam.salam
  • std/ai/tensor/tensor.salam
  • std/bigint/bigint.salam
  • std/chan/chan.salam
  • std/collections/circular_list.salam
  • std/collections/counter.salam
  • std/collections/deque.salam
  • std/collections/hashmap.salam
  • std/collections/linked_list.salam
  • std/collections/ordmap.salam
  • std/collections/priority_queue.salam
  • std/collections/queue.salam
  • std/collections/set.salam
  • std/collections/stack.salam
  • std/core/core.salam
  • std/data/data_csv.salam
  • std/data/data_dataset.salam
  • std/decimal/decimal.salam
  • std/encoding/xml/xpath.salam
  • std/excel/sheet.salam
  • std/excel/style.salam
  • std/excel/workbook.salam
  • std/graph/gr_flownet.salam
  • std/graph/gr_matrix.salam
  • std/graph/gr_treeindex.salam
  • std/graph/gr_util.salam
  • std/graph/graph.salam
  • std/layoutgen/jalali_date.salam
  • std/matrix/mat_special.salam
  • std/matrix/matrix.salam
  • std/npy/npy.salam
  • std/opencv/contours.salam
  • std/opencv/dnn.salam
  • std/opencv/features.salam
  • std/opencv/mat.salam
  • std/opencv/objdetect.salam
  • std/opencv/video.salam
  • std/time/duration.salam
  • std/tui/buffer.salam
  • std/tui/checkbox.salam
  • std/tui/event.salam
  • std/tui/input.salam
  • std/tui/keymap.salam
  • std/tui/layout.salam
  • std/tui/list.salam
  • std/tui/modal.salam
  • std/tui/panel.salam
  • std/tui/progress.salam
  • std/tui/rect.salam
  • std/tui/screen.salam
  • std/tui/separator.salam
  • std/tui/table.salam
  • std/tui/text.salam
  • std/tui/tree.salam
  • tools/salam/std-coverage-docs-baseline.txt
Files with no reviewable changes: 57

  • std/ai/autograd/autograd.salam
  • std/ai/gguf/gguf.salam
  • std/ai/onnx/onnx.salam
  • std/ai/tensor/tensor.salam
  • std/bigint/bigint.salam
  • std/chan/chan.salam
  • std/collections/circular_list.salam
  • std/collections/counter.salam
  • std/collections/deque.salam
  • std/collections/hashmap.salam
  • std/collections/linked_list.salam
  • std/collections/ordmap.salam
  • std/collections/priority_queue.salam
  • std/collections/queue.salam
  • std/collections/set.salam
  • std/collections/stack.salam
  • std/core/core.salam
  • std/data/data_csv.salam
  • std/data/data_dataset.salam
  • std/decimal/decimal.salam
  • std/encoding/xml/xpath.salam
  • std/excel/sheet.salam
  • std/excel/style.salam
  • std/excel/workbook.salam
  • std/graph/gr_flownet.salam
  • std/graph/gr_matrix.salam
  • std/graph/gr_treeindex.salam
  • std/graph/gr_util.salam
  • std/graph/graph.salam
  • std/layoutgen/jalali_date.salam
  • std/matrix/mat_special.salam
  • std/matrix/matrix.salam
  • std/npy/npy.salam
  • std/opencv/contours.salam
  • std/opencv/dnn.salam
  • std/opencv/features.salam
  • std/opencv/mat.salam
  • std/opencv/objdetect.salam
  • std/opencv/video.salam
  • std/time/duration.salam
  • std/tui/buffer.salam
  • std/tui/checkbox.salam
  • std/tui/event.salam
  • std/tui/input.salam
  • std/tui/keymap.salam
  • std/tui/layout.salam
  • std/tui/list.salam
  • std/tui/modal.salam
  • std/tui/panel.salam
  • std/tui/progress.salam
  • std/tui/rect.salam
  • std/tui/screen.salam
  • std/tui/separator.salam
  • std/tui/table.salam
  • std/tui/text.salam
  • std/tui/tree.salam
  • tools/salam/std-coverage-docs-baseline.txt

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

BaseMax and others added 6 commits November 16, 2026 20:27
An interface that names a method in snake_case (forward, handle_event, focusable, close, next and the like) is satisfied by the snake_case function, and the other spelling is not looked up when a struct is checked against an interface. Putting back every twin whose name an interface declares, in either spelling, fixes the 'does not implement interface' errors in the nn and tui examples.
Regenerated from the tool's list output: nothing new, and the 19 no-fa-name entries whose Persian name moved to the surviving function are gone.
@vercel

vercel Bot commented Nov 16, 2026

Copy link
Copy Markdown

Deployment failed for project salam with the following error:

Resource is limited - try again in 1 day (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/salamlang?upgradeToPro=build-rate-limit

@BaseMax
BaseMax marked this pull request as ready for review November 17, 2026 07:50
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
salam Ready Ready Preview Nov 17, 2026 8:14pm UTC

@BaseMax
BaseMax requested a review from a team as a code owner November 17, 2026 07:50
@github-actions

Copy link
Copy Markdown
Contributor
sha=dbe65a560f55ba4824e337018548a4a25d4e9ccd

🤖 Salam AI review

Verdict: ⚠️ Review could not be parsed

commit dbe65a5 · 68 files · +19 −1832 · model salam

Maximum steps for this agent have been reached, so no further tool calls or edits can be made.

So far, I reviewed the PR metadata and inspected representative parts of the diff and repository, including std/tui/widget.salam, std/db/db.salam, std/ai/nn/nn_seq.salam, and std/net/tunnel/*.salam. The change is a large deletion of snake_case forwarding twins, with some Persian-name moves and coverage baseline updates. I identified that interface-declared names must remain in both spellings, and that some PascalCase implementations still call deleted snake_case helpers in the current base tree, which is expected to be resolved by the dependent PR sequence rather than this PR alone.

Remaining tasks:

  • Verify every interface-declared method name still has both spellings.
  • Verify all internal std call sites are converted to PascalCase before this deletion lands.
  • Run the project's compiler, coverage, naming, and test checks after the dependent PRs are merged/rebased.

Recommendation: treat this as a dependent, merge-order-sensitive PR; do not merge it before steps 1-3, and re-run the full validation suite on the combined result.


⚠️ This review was written automatically by an AI and may contain mistakes. It is a helper for maintainers, not a replacement for a human review: check the code yourself before merging.

@BaseMax
BaseMax merged commit e1ee3c2 into main Nov 17, 2026
13 of 18 checks passed
@BaseMax
BaseMax deleted the p2/delete-snake-twins branch November 17, 2026 08:02

This branch was successfully deployed

1 active deployment
Preview — dbe65a56 Deployed Nov 17, 2026 by vercel[bot]
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