pub enum Builtin {
Show 56 variants
IntAdd,
IntSub,
IntMul,
IntPow,
IntDivrem,
IntFor,
IntEq,
IntLt,
IntLe,
IntGt,
IntGe,
ErrRaise,
ErrCatch,
Match,
ListSize,
ListGet,
ListAppend,
ListWith,
ListSplit,
Eq,
MapNil,
MapWith,
MapGet,
MapGets,
MapFor,
MapMerge,
MapCat,
MapWithout,
MapSize,
IntStr,
IntParse,
StrPack,
StrUnpack,
SymFrom,
SymStr,
ModName,
ModExports,
Proto,
Repr,
ObjNew,
ObjValue,
Int,
Str,
Sym,
List,
Map,
Err,
Mod,
Bool,
BoolTrue,
BoolFalse,
BoolAnd,
BoolOr,
BoolNot,
Fun,
Unit,
}Expand description
A native builtin operation in the reserved __ namespace. All are curried.
Variants§
IntAdd
IntSub
IntMul
IntPow
IntDivrem
IntFor
IntEq
Relational tests on two integers, each returning a Bool
iota. These feed if through receiver dispatch (n.lt 60).
IntLt
IntLe
IntGt
IntGe
ErrRaise
ErrCatch
Match
ListSize
ListGet
ListAppend
ListWith
ListSplit
Eq
MapNil
MapWith
MapGet
MapGets
MapFor
MapMerge
MapCat
MapWithout
MapSize
IntStr
IntParse
StrPack
StrUnpack
SymFrom
SymStr
ModName
ModExports
__Mod.exports <Mod>: returns the module’s exported item names as a
sorted list of symbols. A local, private iota, or non-re-exported import
is not an export. Reads the frozen table without evaluating item bodies.
Non-modules raise .not_a_module.
Proto
__proto v: the prototype of any value: an object’s own, or the
builtin module for other kinds. A bare builtin that cuts across kinds.
Total, it serves as the classifier as <Proto> and the basis for
object design. It grants no authority to construct or unwrap.
Repr
__repr v: the display string of any value, matching
to_display. A bare builtin that cuts across kinds.
ObjNew
Object constructor (prototype, payload). Not reachable by name;
only accessible via the __new leaf, which
supplies the prototype from the current module.
ObjValue
Object payload reader (prototype, object). Accessible only via the
__value leaf. Refuses objects whose prototype
does not match the supplied one (.foreign_object), preventing methods
from unwrapping foreign objects.
Int
Str
Sym
List
Map
Err
Mod
Bool
__Bool, the two-iota boolean module. Its const declarations are
true and false, name-sorted
so false is iota index 0 and true is index 1 (see bool_value); it
re-exports each as an item forwarding to it — so Bool.true resolves like a
user module’s re-exported iota, while __true / __false name them
directly (see from_name). Its logic operations
and / or / not
compose them; the relational __Int.* tests produce them.
BoolTrue
__Bool.true / __true: the true iota, an arity-0 value builtin that fires
on reference to bool_value(ctx, true). Both spellings fold to this one op,
so they are the same iota of the same cached __Bool instance.
BoolFalse
__Bool.false / __false: the false iota — BoolTrue’s
counterpart.
BoolAnd
__Bool.and / or / not — strict logic over two Bool
iotas (one, for not); a non-Bool argument raises .not_a_bool.
BoolOr
BoolNot
Fun
__Fun, the prototype of every callable kind — a closure, a builtin, and
a host function. It has no items yet: docs/todo/elly-function-arity.md
is what gives it nargs / nfree / nrets. It exists for the totality of
Proto, which is enough on its own to make it a module.
Unit
Implementations§
Source§impl Builtin
impl Builtin
Sourcepub fn from_name(name: &str) -> Option<Builtin>
pub fn from_name(name: &str) -> Option<Builtin>
Resolves a __-name to its builtin: a bare name (__eq), a builtin
module (__Int), or a module member in dotted form (__Int.add).
Since Muon symbols cannot contain dots, the parser reaches members via
member after folding. This method is used by tooling and
the Builtin::ALL round-trip.
Sourcepub fn from_alias(name: &str) -> Option<Builtin>
pub fn from_alias(name: &str) -> Option<Builtin>
The builtin module this bare alias names (e.g. Int → __Int).
Aliases are the resolver’s bottom tier (the prelude), consulted last to
ensure they are shadowed by lexical bindings.
Sourcepub fn member(self, name: &str) -> Option<Builtin>
pub fn member(self, name: &str) -> Option<Builtin>
The item of this builtin module matching name, if any. Returns None
if the name is not held or the builtin is not a module. Safe to call on
any callee of a call spine.
Sourcepub fn proto_kind(self) -> Option<TyKind>
pub fn proto_kind(self) -> Option<TyKind>
The value kind this builtin module is the prototype of, enabling as <Proto>
patterns to compile to discriminant tests. Returns None if not a module
or for __Err (no value has __Err as its prototype).