partway towards commands

I got very confused and started mucking about with "spawn" when in fact all I needed was the "inline" extension type in orcx that allows the interpreter to expose custom constants.
This commit is contained in:
2026-03-13 16:48:42 +01:00
parent cdcca694c5
commit 09cfcb1839
146 changed files with 3582 additions and 2822 deletions

View File

@@ -11,11 +11,7 @@ use futures::{AsyncWrite, FutureExt};
use itertools::Itertools;
use never::Never;
use orchid_api_traits::Encode;
use orchid_base::clone;
use orchid_base::error::OrcRes;
use orchid_base::format::{FmtCtx, FmtUnit};
use orchid_base::location::Pos;
use orchid_base::name::Sym;
use orchid_base::{FmtCtx, FmtUnit, OrcRes, Pos, Sym, clone};
use task_local::task_local;
use trait_set::trait_set;
@@ -129,7 +125,7 @@ impl Atomic for Fun {
impl OwnedAtom for Fun {
type Refs = Vec<Expr>;
async fn val(&self) -> Cow<'_, Self::Data> { Cow::Owned(()) }
async fn call_ref(&self, arg: Expr) -> GExpr {
async fn call_ref(&self, arg: Expr) -> impl ToExpr {
let new_args = self.args.iter().cloned().chain([arg]).collect_vec();
if new_args.len() == self.record.argtyps.len() {
(self.record.fun)(new_args).await.to_gen().await
@@ -137,7 +133,6 @@ impl OwnedAtom for Fun {
new_atom(Self { args: new_args, record: self.record.clone(), path: self.path.clone() })
}
}
async fn call(self, arg: Expr) -> GExpr { self.call_ref(arg).await }
async fn serialize(&self, write: Pin<&mut (impl AsyncWrite + ?Sized)>) -> Self::Refs {
self.path.to_api().encode(write).await.unwrap();
self.args.clone()
@@ -175,7 +170,7 @@ impl Atomic for Lambda {
impl OwnedAtom for Lambda {
type Refs = Never;
async fn val(&self) -> Cow<'_, Self::Data> { Cow::Owned(()) }
async fn call_ref(&self, arg: Expr) -> GExpr {
async fn call_ref(&self, arg: Expr) -> impl ToExpr {
let new_args = self.args.iter().cloned().chain([arg]).collect_vec();
if new_args.len() == self.record.argtyps.len() {
(self.record.fun)(new_args).await.to_gen().await
@@ -183,14 +178,13 @@ impl OwnedAtom for Lambda {
new_atom(Self { args: new_args, record: self.record.clone() })
}
}
async fn call(self, arg: Expr) -> GExpr { self.call_ref(arg).await }
}
mod expr_func_derives {
use std::any::TypeId;
use std::sync::OnceLock;
use orchid_base::error::OrcRes;
use orchid_base::OrcRes;
use super::{ARGV, ExprFunc};
use crate::conv::{ToExpr, TryFromExpr};
@@ -224,7 +218,7 @@ mod expr_func_derives {
expr_func_derive!(A, B, C);
expr_func_derive!(A, B, C, D);
expr_func_derive!(A, B, C, D, E);
// expr_func_derive!(A, B, C, D, E, F);
expr_func_derive!(A, B, C, D, E, F);
// expr_func_derive!(A, B, C, D, E, F, G);
// expr_func_derive!(A, B, C, D, E, F, G, H);
// expr_func_derive!(A, B, C, D, E, F, G, H, I);