A fast, friendly, functional language. https://roc-lang.org
Find a file
Richard Feldman 7d0a269fb7
Implement ? (question mark) operator for error propagation
The ? operator now desugars expr? to a match expression that unwraps Ok
values and early returns Err values:

  match expr {
      Ok($q_ok) => $q_ok,
      Err($q_err) => return Err($q_err),
  }

Implementation details:
- Canonicalize the inner expression
- Create synthetic identifiers for Ok/Err values ($q_ok, $q_err)
- Create applied_tag patterns for Ok and Err
- Build match branches with proper scope isolation
- Mark synthetic patterns as used to avoid unused variable warnings
- Create e_lookup_local, e_tag, and e_return expressions for branch bodies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 20:02:01 -05:00
.cargo
.devcontainer
.github ubuntu 22 run fx_platform tests (#8496) 2025-11-29 13:33:15 +01:00
.reuse
ci fix permissions + no old CI 2025-11-27 22:27:33 +01:00
crates Bump node-forge from 1.3.1 to 1.3.2 in /crates/compiler/checkmate/www (#8462) 2025-11-27 10:40:55 +01:00
design
devtools
docker
docs Implement ? (question mark) operator for error propagation 2025-11-29 20:02:01 -05:00
examples
nix
src Implement ? (question mark) operator for error propagation 2025-11-29 20:02:01 -05:00
test Implement ? (question mark) operator for error propagation 2025-11-29 20:02:01 -05:00
.gitattributes
.gitignore
.llvmenv
.rules Merge origin/main 2025-11-22 15:45:17 -05:00
AGENT.md
authors
build.zig fix linux segfault fx platform tests (#8497) 2025-11-29 14:24:16 +01:00
build.zig.zon
BUILDING_FROM_SOURCE.md
Cargo.lock
Cargo.toml
code_of_conduct.md
CONTRIBUTING.md
default.nix
flake.lock
flake.nix
Glossary.md
legal_details
LICENSE
mlc_config.json
README.md
rust-toolchain.toml
shell.nix
typos.toml
version.txt

Work in progress!

Roc is not ready for a 0.1 release yet, but we do have:

If you'd like to contribute, get started here. Don't hesitate to ask for help on our group chat, we're friendly!

Sponsors

You can 💜 sponsor 💜 Roc on:

We are very grateful for our corporate sponsors Lambda Class, ohne-makler, and Decem:

Lambda Class logo      ohne-makler logo      Decem logo

If you would like your company to become a corporate sponsor of Roc's development, please DM Richard Feldman on Zulip!

We'd also like to express our gratitude to our generous individual sponsors! A special thanks to those sponsoring $25/month or more:

Thank you all so much for helping Roc progress!