diff options
| -rw-r--r-- | docs/PLUGINS.md | 2 | ||||
| -rw-r--r-- | docs/std/env.md | 10 | ||||
| -rw-r--r-- | docs/std/fs.md | 6 | ||||
| -rw-r--r-- | docs/std/io.md | 4 | ||||
| -rw-r--r-- | docs/std/map.md | 6 | ||||
| -rw-r--r-- | docs/std/option.md | 4 | ||||
| -rw-r--r-- | docs/std/path.md | 4 | ||||
| -rw-r--r-- | docs/std/queue.md | 2 | ||||
| -rw-r--r-- | docs/std/result.md | 2 | ||||
| -rw-r--r-- | docs/std/string.md | 2 | ||||
| -rw-r--r-- | docs/std/vec.md | 2 | ||||
| -rw-r--r-- | examples/algorithms/sieve.zc | 2 | ||||
| -rw-r--r-- | examples/gpu/cuda-benchmark.zc | 8 | ||||
| -rw-r--r-- | examples/gpu/cuda_vector_add.zc | 4 | ||||
| -rw-r--r-- | examples/process/env.zc | 8 | ||||
| -rw-r--r-- | examples/scripting/lua/lua.zc | 10 |
16 files changed, 38 insertions, 38 deletions
diff --git a/docs/PLUGINS.md b/docs/PLUGINS.md index ea21485..5e78d29 100644 --- a/docs/PLUGINS.md +++ b/docs/PLUGINS.md @@ -13,7 +13,7 @@ import plugin "regex" as re // or simple: import plugin "regex" (uses "regex" as identifier) fn main() { - var valid = re! { ^[a-z]+$ }; + let valid = re! { ^[a-z]+$ }; } ``` diff --git a/docs/std/env.md b/docs/std/env.md index 09ece60..dd56e4f 100644 --- a/docs/std/env.md +++ b/docs/std/env.md @@ -10,7 +10,7 @@ import "std/env.zc" fn main() { Env::set("HELLO", "world"); - var hello = Env::get("HELLO"); + let hello = Env::get("HELLO"); if (hello.is_some()) { println "Hello {hello.unwrap()}"; @@ -31,7 +31,7 @@ enum EnvRes { ### get -Retrieves the env-var as borrowed string (char *) (no alloc) +Retrieves the env-variable as borrowed string (char *) (no alloc) ```zc fn get(name: string) -> Option<string> @@ -39,7 +39,7 @@ fn get(name: string) -> Option<string> ### get_dup -Retrieves the env-var as caller-owned String() (heap alloc) +Retrieves the env-variable as caller-owned String() (heap alloc) ```zc fn get_dup(name: string) -> Option<String> @@ -47,7 +47,7 @@ fn get_dup(name: string) -> Option<String> ### set -Sets an env-var variable +Sets an env-variable ```zc fn set(name: string, value: string) -> EnvRes @@ -55,7 +55,7 @@ fn set(name: string, value: string) -> EnvRes ### unset -Unsets an existing env-var +Unsets an existing env-variable ```zc fn unset(name: string) -> EnvRes diff --git a/docs/std/fs.md b/docs/std/fs.md index 8aea0f5..42d10c4 100644 --- a/docs/std/fs.md +++ b/docs/std/fs.md @@ -9,10 +9,10 @@ import "std/fs.zc" fn main() { // Reading a file - var res = File::open("example.txt", "r"); + let res = File::open("example.txt", "r"); if (res.is_ok()) { - var file = res.unwrap(); - var content = file.read_to_string(); + let file = res.unwrap(); + let content = file.read_to_string(); if (content.is_ok()) { println "{content.unwrap()}"; } diff --git a/docs/std/io.md b/docs/std/io.md index 825728d..7f46940 100644 --- a/docs/std/io.md +++ b/docs/std/io.md @@ -12,11 +12,11 @@ fn main() { io.println("Hello %s", "World"); // Formatting strings - autofree var s = io.format_new("Value: %d", 42); + autofree let s = io.format_new("Value: %d", 42); // Reading input io.print("Enter name: "); - autofree var name = io.readln(); + autofree let name = io.readln(); } ``` diff --git a/docs/std/map.md b/docs/std/map.md index f8bd76a..08949bd 100644 --- a/docs/std/map.md +++ b/docs/std/map.md @@ -8,13 +8,13 @@ import "std/map.zc" fn main() { - var m = Map<int>::new(); + let m = Map<int>::new(); m.put("one", 1); m.put("two", 2); if (m.contains("one")) { - var val = m.get("one"); + let val = m.get("one"); println "{val.unwrap()}"; } @@ -45,7 +45,7 @@ struct Map<V> { You can iterate over the map's key-value pairs using a `for` loop. ```zc -var m = Map<int>::new(); +let m = Map<int>::new(); m.put("a", 1); for entry in m { diff --git a/docs/std/option.md b/docs/std/option.md index a048b00..fbbc296 100644 --- a/docs/std/option.md +++ b/docs/std/option.md @@ -8,13 +8,13 @@ import "std/option.zc" fn main() { - var val = Option<int>::Some(10); + let val = Option<int>::Some(10); if (val.is_some()) { println "{val.unwrap()}"; } - var nothing = Option<int>::None(); + let nothing = Option<int>::None(); println "{nothing.unwrap_or(0)}"; // Prints 0 } ``` diff --git a/docs/std/path.md b/docs/std/path.md index 0be30fd..798144a 100644 --- a/docs/std/path.md +++ b/docs/std/path.md @@ -8,8 +8,8 @@ import "std/path.zc" fn main() { - var p = Path::new("/home/user"); - var full_path = p.join("docs/file.txt"); + let p = Path::new("/home/user"); + let full_path = p.join("docs/file.txt"); println "Full path: {full_path.c_str()}"; diff --git a/docs/std/queue.md b/docs/std/queue.md index d463f15..c7db3fd 100644 --- a/docs/std/queue.md +++ b/docs/std/queue.md @@ -8,7 +8,7 @@ import "std/queue.zc" fn main() { - var q = Queue<int>::new(); + let q = Queue<int>::new(); q.push(1); q.push(2); diff --git a/docs/std/result.md b/docs/std/result.md index 1f9390e..da60b8d 100644 --- a/docs/std/result.md +++ b/docs/std/result.md @@ -15,7 +15,7 @@ fn divide(a: int, b: int) -> Result<int> { } fn main() { - var res = divide(10, 2); + let res = divide(10, 2); if (res.is_ok()) { println "Result: {res.unwrap()}"; } else { diff --git a/docs/std/string.md b/docs/std/string.md index 252b737..ae4b738 100644 --- a/docs/std/string.md +++ b/docs/std/string.md @@ -8,7 +8,7 @@ import "std/string.zc" fn main() { - var s = String::from("Hello"); + let s = String::from("Hello"); s.append(String::from(" World")); println "{s}"; // Prints "Hello World" diff --git a/docs/std/vec.md b/docs/std/vec.md index 1b48361..7bc7c05 100644 --- a/docs/std/vec.md +++ b/docs/std/vec.md @@ -15,7 +15,7 @@ import "std/vec.zc" fn main() { - var v = Vec<int>::new(); + let v = Vec<int>::new(); v.push(10); v.push(20); diff --git a/examples/algorithms/sieve.zc b/examples/algorithms/sieve.zc index 2f5680e..147d71f 100644 --- a/examples/algorithms/sieve.zc +++ b/examples/algorithms/sieve.zc @@ -2,7 +2,7 @@ import "std.zc" fn main() { - const LIMIT = 50; + def LIMIT = 50; let is_prime: bool[LIMIT]; for i in 0..LIMIT { is_prime[i] = true; } diff --git a/examples/gpu/cuda-benchmark.zc b/examples/gpu/cuda-benchmark.zc index cea326e..8f4a85d 100644 --- a/examples/gpu/cuda-benchmark.zc +++ b/examples/gpu/cuda-benchmark.zc @@ -194,7 +194,7 @@ fn benchmark_matrix_multiply(N: int) { cuda_copy_to_device(d_B, h_B, size * sizeof(float)); // Configure grid - const BLOCK_SIZE = 16; + def BLOCK_SIZE = 16; let blocks_per_grid = (N + BLOCK_SIZE - 1) / BLOCK_SIZE; "-> Launching kernel: {blocks_per_grid}x{blocks_per_grid} blocks, {BLOCK_SIZE}x{BLOCK_SIZE} threads each"; @@ -232,8 +232,8 @@ fn benchmark_monte_carlo_pi(num_samples: u64) { "-> Estimating Pi with {num_samples} samples"; - const BLOCK_SIZE = 256; - const NUM_BLOCKS = 1024; + def BLOCK_SIZE = 256; + def NUM_BLOCKS = 1024; let total_threads = BLOCK_SIZE * NUM_BLOCKS; // Allocate memory @@ -342,7 +342,7 @@ fn benchmark_nbody(num_bodies: int, num_steps: int) { cuda_copy_to_device(d_vy, h_vy, num_bodies * sizeof(float)); cuda_copy_to_device(d_vz, h_vz, num_bodies * sizeof(float)); - const BLOCK_SIZE = 256; + def BLOCK_SIZE = 256; let num_blocks = (num_bodies + BLOCK_SIZE - 1) / BLOCK_SIZE; let dt = 0.01f; diff --git a/examples/gpu/cuda_vector_add.zc b/examples/gpu/cuda_vector_add.zc index d1f896a..534950d 100644 --- a/examples/gpu/cuda_vector_add.zc +++ b/examples/gpu/cuda_vector_add.zc @@ -15,7 +15,7 @@ fn add_kernel(a: float*, b: float*, c: float*, n: int) { } fn main() { - const N = 1024; + def N = 1024; "=> Zen C CUDA Vector Addition"; "-> Vector size: {N} elements"; @@ -43,7 +43,7 @@ fn main() { cuda_copy_to_device(d_a, h_a, N * sizeof(float)); cuda_copy_to_device(d_b, h_b, N * sizeof(float)); - const BLOCK_SIZE = 256; + def BLOCK_SIZE = 256; let num_blocks = (N + BLOCK_SIZE - 1) / BLOCK_SIZE; "-> Launching: {num_blocks} blocks x {BLOCK_SIZE} threads"; diff --git a/examples/process/env.zc b/examples/process/env.zc index 0ea7437..d202ef2 100644 --- a/examples/process/env.zc +++ b/examples/process/env.zc @@ -4,7 +4,7 @@ import "std/env.zc" fn main() -> int { // ---- - // get: Retrieves the env-let as borrowed string (char *) (no alloc) + // get: Retrieves the env-variable as borrowed string (char *) (no alloc) // --- // @Example usage: On Linux (and some variants) PATH is already defined. // --- @@ -17,8 +17,8 @@ fn main() -> int { } // ---- - // set: Sets an env-let variable - // get_dup: Retrieves the env-let as caller-owned String() (heap alloc) + // set: Sets an env-variable + // get_dup: Retrieves the env-variable as caller-owned String() (heap alloc) // --- // @Example usage: In your terminal type "export HELLO=world" or use Env::set() // --- @@ -37,7 +37,7 @@ fn main() -> int { } // ---- - // unset: Unsets an existing env-let + // unset: Unsets an existing env-variable // --- Env::unset("HELLO"); diff --git a/examples/scripting/lua/lua.zc b/examples/scripting/lua/lua.zc index a8463fa..ebd3ae6 100644 --- a/examples/scripting/lua/lua.zc +++ b/examples/scripting/lua/lua.zc @@ -8,7 +8,7 @@ import "lauxlib.h"; import "lualib.h"; fn l_zenc_hello(L: lua_State*) -> int { - const name: string = (string)luaL_optstring(L, 1, "world"); + let name: string = (string)luaL_optstring(L, 1, "world"); println "hello from Zen-C, {name}" return 0; } @@ -27,21 +27,21 @@ fn main() { lua_setglobal(L, "zenc_hello"); // Run some Lua from a Zen-C variable - const script = "print('hello from lua')\nzenc_hello('test')\n"; + let script = "print('hello from lua')\nzenc_hello('test')\n"; if (luaL_dostring(L, script) != LUA_OK) { - const err: string = (string)lua_tostring(L, -1); + let err: string = (string)lua_tostring(L, -1); !"lua error: {err}" lua_pop(L, 1); } // Run some Lua from a script file if (luaL_loadfile(L, "script.lua") != LUA_OK) { - const err: string = (string)lua_tostring(L, -1); + let err: string = (string)lua_tostring(L, -1); !"lua load-error: {err}" lua_pop(L, 1); } else if (lua_pcall(L, 0, 0, 0) != LUA_OK) { - const err: string = (string)lua_tostring(L, -1); + let err: string = (string)lua_tostring(L, -1); !"lua error: {err}" lua_pop(L, 1); } |
