aboutsummaryrefslogtreecommitdiff
path: root/std/prelude/arrays.pk
diff options
context:
space:
mode:
authorJJ2024-05-10 07:54:48 +0000
committerJJ2024-05-10 07:54:48 +0000
commit199d8bbc6d5793d895311cb0d2296f3e1279a3e0 (patch)
treefc71fd1d2f20029294f309f2947559e5b4d3d704 /std/prelude/arrays.pk
parentd3c91164aff6a620348c81776fdae37fa41b81c3 (diff)
std: replace static with const, fix std.ast
Diffstat (limited to 'std/prelude/arrays.pk')
-rw-r--r--std/prelude/arrays.pk14
1 files changed, 7 insertions, 7 deletions
diff --git a/std/prelude/arrays.pk b/std/prelude/arrays.pk
index 6f57865..d8512dd 100644
--- a/std/prelude/arrays.pk
+++ b/std/prelude/arrays.pk
@@ -3,28 +3,28 @@
## Primitive fixed-size arrays. Their size is statically known at compile-time.
@[magic]
-pub type array[T, size: static uint]
+pub type array[T, size: const uint]
## Array access. Returns None if i is out of range.
@[magic]
-pub func get[T, size: static uint](self: lent array[T, size], i: uint): lent T?
+pub func get[T, size: const uint](self: lent array[T, size], i: uint): lent T?
## Array access. Returns None if i is out of range.
@[magic]
-pub func get[T, size: static uint](self: mut array[T, size], i: uint): mut T?
+pub func get[T, size: const uint](self: mut array[T, size], i: uint): mut T?
## Array mutation.
# todo: how do we detect range errors?
@[magic]
-pub func set[T, size: static uint](self: mut array[T, size], i: uint, val: T): Success[IndexOutOfBounds]
+pub func set[T, size: const uint](self: mut array[T, size], i: uint, val: T): Success[IndexOutOfBounds]
## A helper function to get the length of an array.
## Known to the compiler, and computed at compile-time.
@[inline]
-pub func len[T, size: static uint](self: lent array[T, size]): uint = size
+pub func len[T, size: const uint](self: lent array[T, size]): uint = size
-type ArrayIter[T, size: static uint] = struct
+type ArrayIter[T, size: const uint] = struct
...
-pub func iter[T, size: static uint](self: array[T, size]): ArrayIter[T, S] =
+pub func iter[T, size: const uint](self: array[T, size]): ArrayIter[T, S] =
...
# todo: Eq, PartialEq, Ord, PartialOrd