pub struct FreeBuiltinSchema {
pub name: &'static str,
pub kind: FreeBuiltinKind,
pub generics: &'static [&'static str],
pub params: &'static [ParamSchema],
pub result: BuiltinType,
}Expand description
One builtin that is called on nothing.
A BuiltinSchema is keyed by a receiver, and these have none: Ok(1)
and assert(true) are written bare, like a declared function and unlike
items.length() or Vector.of(1). Straining the receiver-keyed table to
hold them would have meant inventing a receiver they do not have, so they
have a table of their own, and it is close to the plainest thing that lets
both ends stop restating each other: a name, which kind it is, and the
parameters it takes.
The result is here too, because the checker reads it in both directions.
A constructor’s result is generic — Ok(value: T) -> Result<T, E> — and
the type a call site expects is what settles T and E, so the one
declaration that says what Ok produces is also the one that says what
its payload must be. That is why this carries a signature rather than only
an arity: the arity is what the runtime needs, and the signature is what
stops the checker from writing the same five names out again to say what
each of them makes.
Fields§
§name: &'static strThe name Cove source calls, such as Ok.
kind: FreeBuiltinKindWhether this builds a value or checks one.
generics: &'static [&'static str]The type parameters this signature binds.
Every type parameter a free builtin names is one it binds itself: there is no receiver to read one off. A call site settles them from the type it expects, and from the arguments where it expects nothing in particular.
params: &'static [ParamSchema]Parameters in declaration order, labelled as a diagnostic names them.
result: BuiltinTypeThe type the call produces.
Implementations§
Trait Implementations§
Source§impl Clone for FreeBuiltinSchema
impl Clone for FreeBuiltinSchema
Source§fn clone(&self) -> FreeBuiltinSchema
fn clone(&self) -> FreeBuiltinSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FreeBuiltinSchema
Source§impl Debug for FreeBuiltinSchema
impl Debug for FreeBuiltinSchema
impl Eq for FreeBuiltinSchema
Source§impl PartialEq for FreeBuiltinSchema
impl PartialEq for FreeBuiltinSchema
Source§fn eq(&self, other: &FreeBuiltinSchema) -> bool
fn eq(&self, other: &FreeBuiltinSchema) -> bool
self and other values to be equal, and is used by ==.