From e4ce7f658741a7428597da4872435a1b0bae944c Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sat, 3 Oct 2026 20:51:22 +0200 Subject: Rework generics for parameters to be plain types --- include/elna/boot/symbol.h | 8 ++++---- include/elna/boot/type_check.h | 15 +++++---------- 2 files changed, 9 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/elna/boot/symbol.h b/include/elna/boot/symbol.h index 31d5c45..705cb29 100644 --- a/include/elna/boot/symbol.h +++ b/include/elna/boot/symbol.h @@ -225,10 +225,10 @@ namespace elna::boot /** * Type parameter of a generic declaration. * - * It denotes an unknown pointer type chosen at instantiation, so it is - * usable wherever a pointer is, and erases to a pointer in the backend. - * Each declaration gets fresh parameters; two parameters spelled alike in - * different declarations never compare equal. + * It denotes an unknown opaque type chosen at instantiation, so it is + * usable only behind a pointer (^T), and ^T erases to a pointer in the + * backend. Each declaration gets fresh parameters; two parameters spelled + * alike in different declarations never compare equal. */ struct parameter_type { diff --git a/include/elna/boot/type_check.h b/include/elna/boot/type_check.h index 5e4f792..5a2d7f1 100644 --- a/include/elna/boot/type_check.h +++ b/include/elna/boot/type_check.h @@ -177,10 +177,6 @@ namespace elna::boot { std::string parameter; }; - struct argument_not_pointer - { - type actual; - }; struct argument_not_scalar { type actual; @@ -200,7 +196,7 @@ namespace elna::boot }; using payload_type = std::variant; generic_error(const source_position position, const std::string& generic_name, @@ -216,14 +212,13 @@ namespace elna::boot /** * What a generic declaration accepts as a type argument. * - * An erased generic takes a pointer, because that is what its single - * compiled body knows how to move. A builtin has no body to erase, so it - * takes whatever it can load or store, and only a reading one tolerates a - * constant. + * An erased generic takes an opaque pointee, because it is only used + * behind a pointer. A builtin has no body to erase, so it takes whatever + * it can load or store, and only a reading one tolerates a constant. */ enum class argument_rule { - pointer, + opaque, scalar, mutable_scalar }; -- cgit v1.2.3