Repository navigation
lang: throw, try and catch with one Error type - #2466
Conversation
Persian spellings are تلاش, گرفتن خطا, پرتاب خطا and خطادار. The parser takes throws after a return type, throw as a statement, try as a prefix with an optional catch fallback, and try: ... catch e: ... end blocks.
A throws function returns Throws<T>; every throwing call is hoisted and checked, so no backend needs unwinding. Error, ErrorKind and Throws resolve from core without an import.
The error package's Persian name becomes خطاها so importing it no longer hides the type خطا.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedToo many files! This PR contains 153 files, which is 53 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Secrets | Oct 28, 2026 6:14p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| JavaScript | Oct 28, 2026 6:14p.m. | Review ↗ | |
| Secrets | Oct 28, 2026 6:14p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Salam had no single way to report an error: out-parameters of many shapes, sentinels, silent zeros, global LastError, and a separate error struct per package. This adds checked errors to the language and one error type to throw.
throwsafter the return type,throw,try expr,try expr catch fallback, andtry: ... catch e: ... end. Persian:خطادار,پرتاب خطا,تلاش,گرفتن خطا.Throws<T>return plus a check after each call, so nothing is unwound and no backend needed new machinery (onlycontinueacross atry:block is refused for now).deferruns on every exit. Panics are not caught.Error,ErrorKindandThrowslive incoreand need no import.std/erroris rewritten around them and keeps the retry helpers; its Persian package name becomesخطاهاso it no longer hides the typeخطا.func main throwsprintserror: ...to stderr and exits 1.try, E141 misplaced or mistypedthrow, E142trywith nothing that can throw.raise,exceptandfinallyget targeted hints.تلاشis now a keyword, so the Persian names that contained it useکوششinstead (23 std/package names, theposition tryCSS properties, and the fa tests and examples that used them).tryis a keyword too, so the examples and the test that named a helpertrycall itattemptnow.std still uses the old conventions; moving encoding/json and the rest onto
throws(and removing encoding.encerr) comes next, once a release with this compiler is the seed.Tested on C, LLVM (JIT), the interpreter and JS: features, errors, exec, js and llvm all pass (1095 tests), stdlib and general pass in both languages (1962 tests; net_proxy hit a port collision once and passes on rerun). The rewritten website examples were run in both languages, and prek passes on the changed files.