Massive feature drop

- pattern matching seems to be correct
- dynamic dispatch works with the to_string example
- template strings as a last-minute addition
- interpreter revamp, virtual stack for abort safety
This commit is contained in:
2024-01-29 18:26:56 +00:00
parent a8887227e5
commit c279301583
71 changed files with 947 additions and 932 deletions

View File

@@ -10,7 +10,7 @@ use crate::location::CodeLocation;
pub trait ExternError: Display + Send + Sync + DynClone {
/// Convert into trait object
#[must_use]
fn rc(self) -> Arc<dyn ExternError>
fn rc(self) -> ExternErrorObj
where Self: 'static + Sized {
Arc::new(self)
}
@@ -25,7 +25,10 @@ impl Debug for dyn ExternError {
impl Error for dyn ExternError {}
/// An error produced by Rust code called form Orchid. The error is type-erased.
pub type ExternResult<T> = Result<T, Arc<dyn ExternError>>;
pub type ExternErrorObj = Arc<dyn ExternError>;
/// A result produced by Rust code called from Orchid.
pub type ExternResult<T> = Result<T, ExternErrorObj>;
/// Some expectation (usually about the argument types of a function) did not
/// hold.
@@ -52,7 +55,7 @@ impl AssertionError {
location: CodeLocation,
message: &'static str,
details: String,
) -> Arc<dyn ExternError> {
) -> ExternErrorObj {
Self { location, message, details }.rc()
}
}