Skip to main content

Builtin

Enum Builtin 

Source
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

__Unit, the prototype of the unit value (). It has no items — a nominal type only, exactly like Fun — and exists so every value, unit included, answers Proto.

Implementations§

Source§

impl Builtin

Source

pub const ALL: &'static [Builtin]

Every nameable builtin in declaration order; the source of truth for tooling enumerating the __ namespace. Keep in sync with the enum.

ObjNew and ObjValue are omitted as no name resolves to them; they only render via name.

Source

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.

Source

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.

Source

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.

Source

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).

Source

pub fn name(self) -> &'static str

The reserved __-name for this builtin. Module members are dotted (e.g. __Int.add).

Trait Implementations§

Source§

impl Clone for Builtin

Source§

fn clone(&self) -> Builtin

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Builtin

Source§

impl Debug for Builtin

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Builtin

Source§

impl Hash for Builtin

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Builtin

Source§

fn cmp(&self, other: &Builtin) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Builtin

Source§

fn eq(&self, other: &Builtin) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Builtin

Source§

fn partial_cmp(&self, other: &Builtin) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Builtin

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.