How should symbols be declared in orco?

by Dima Lobach · 1 year ago
"comptime": ``` comptime std = module { ⠀⠀comptime puts = extern fn puts(msg: *char) -> i32; ⠀⠀comptime compute = () -> i32 { ⠀⠀⠀⠀comptime x = /*some heavy computation, that happens at compile-time*/; ⠀⠀⠀⠀let y = 3; ⠀⠀⠀⠀x + y ⠀⠀}; }; comptime main = fn () -> i32 std::puts(c"Hello, World!"); ``` "symbol": ``` symbol std = module { ⠀⠀symbol puts = extern fn puts(msg: *char) -> i32; ⠀⠀symbol compute = () -> i32 { ⠀⠀⠀⠀symbol x = /*some heavy computation, that happens at compile-time*/; ⠀⠀⠀⠀let y = 3; ⠀⠀⠀⠀x + y ⠀⠀}; }; symbol main = fn () -> i32 std::puts(c"Hello, World!"); ``` "const": ``` const std = module { ⠀⠀const puts = extern fn puts(msg: *char) -> i32; ⠀⠀const compute = () -> i32 { ⠀⠀⠀⠀const x = /*some heavy computation, that happens at compile-time*/; ⠀⠀⠀⠀let y = 3; // Note: This is immutable, but run-time ⠀⠀⠀⠀x + y ⠀⠀}; }; const main = fn () -> i32 std::puts(c"Hello, World!"); ``` Nothing: ``` std = module { ⠀⠀puts = extern fn puts(msg: *char) -> i32; ⠀⠀compute = () -> i32 { ⠀⠀⠀⠀x = /*some heavy computation, that happens at compile-time*/; ⠀⠀⠀⠀let y = 3; ⠀⠀⠀⠀x + y ⠀⠀}; }; main = fn () -> i32 std::puts(c"Hello, World!"); ``` "::": ``` std :: module { ⠀⠀puts :: extern fn puts(msg: *char) -> i32; ⠀⠀compute :: () -> i32 { ⠀⠀⠀⠀x :: /*some heavy computation, that happens at compile-time*/; ⠀⠀⠀⠀let y = 3; ⠀⠀⠀⠀x + y ⠀⠀}; }; main :: fn () -> i32 std::puts(c"Hello, World!"); ```
Make a choice:
Poll options
Other:
Voting closed 352 days, 20 hours, 57 seconds ago.
Results

Comments

No comments yet. Be the first to write one!

This content is neither created nor endorsed by StrawPoll.

Create Your Own Poll

Want to create your own poll? With StrawPoll anyone can easily create an online poll in seconds.