P5.7 Step D: re-express metatype declare() as sx over declare_type
declare(name) is now an ordinary sx fn in modules/std/meta.sx that calls the
abi(.compiler) declare_type primitive — both mint/find the same forward nominal
slot. Removed the bespoke .declare arm from callBuiltinVm and the BuiltinId.declare
member; dropped the declare interception in tryLowerReflectionCall (the call now
routes to the sx fn). preregisterForwardTypes still scans for the literal
declare("Name") spelling so *Name self-references forward-register before the
body lowers (0618). define/type_info/field_type remain builtins.
This commit is contained in:
@@ -452,17 +452,14 @@ pub const BuiltinId = enum(u16) {
|
||||
type_eq,
|
||||
type_is_unsigned,
|
||||
has_impl,
|
||||
// The compiler's ONLY comptime type-CONSTRUCTION primitives. Higher-level
|
||||
// The comptime type-CONSTRUCTION terminator builtin. Higher-level
|
||||
// constructors (one-shot, channel-result, etc.) are ordinary sx built over
|
||||
// these — the compiler knows none of them by name. Both are comptime-only
|
||||
// (the interp mutates the type table via its
|
||||
// `mint` handle); reaching them at runtime / emit is a hard error.
|
||||
// declare() → mint an EMPTY (undefined) nominal slot, returned
|
||||
// as a `Type` value. Using the slot before its
|
||||
// `define` is a loud diagnostic.
|
||||
// it — the compiler knows none of them by name. Comptime-only (the comptime
|
||||
// VM mutates the type table); reaching it at runtime / emit is a hard error.
|
||||
// (`declare` is no longer a builtin — it's plain sx over the `declare_type`
|
||||
// compiler-API primitive in `modules/std/meta.sx`.)
|
||||
// define(handle, info) → decode the `TypeInfo` VALUE (the name travels in
|
||||
// it) and complete the slot.
|
||||
declare,
|
||||
define,
|
||||
// The comptime reflection INVERSE of `define`: read a type's variants
|
||||
// (name + payload type) out of the type table and CONSTRUCT the same
|
||||
|
||||
Reference in New Issue
Block a user