Generics with <>. Deprecation of {} generics.

This commit is contained in:
Christoffer Lerno
2026-01-18 00:33:43 +01:00
parent d3ebd4a130
commit c3b2694834
93 changed files with 179 additions and 197 deletions

View File

@@ -1060,7 +1060,7 @@ fn void* __memcpy(void* dst, void* src, usz n) @weak @export("memcpy")
}
module std::core::mem::volatile { Type };
module std::core::mem::volatile <Type>;
typedef Volatile @structlike = Type;
@@ -1077,7 +1077,7 @@ macro Type Volatile.set(&self, Type val)
<*
@require mem::@constant_is_power_of_2(ALIGNMENT) : "The alignment must be a power of 2"
*>
module std::core::mem::alignment { Type, ALIGNMENT };
module std::core::mem::alignment <Type, ALIGNMENT>;
import std::core::mem @public;
<*

View File

@@ -8,7 +8,7 @@
@require !$defined(Type.dealloc) ||| $defined(Type.dealloc(&&(Type){})) : "'dealloc' must only take a pointer to the underlying type"
@require !$defined(Type.dealloc) ||| $typeof((Type){}.dealloc()) == void : "'dealloc' must return 'void'"
*>
module std::core::mem::ref { Type };
module std::core::mem::ref <Type>;
import std::thread, std::atomic;
const OVERALIGNED @private = Type.alignof > mem::DEFAULT_MEM_ALIGNMENT;

View File

@@ -1,10 +1,10 @@
module std::core::array::slice {Type};
module std::core::array;
<*
A slice2d allows slicing an array like int[10][10] into an arbitrary "int[][]"-like counterpart
Typically you'd use array::slice2d(...) to create one.
*>
struct Slice2d
struct Slice2d <Type>
{
Type* ptr;
usz inner_len;