privatise

This commit is contained in:
numzero 2025-04-11 20:36:28 +03:00
parent 9562da5518
commit ec3b41809d

View File

@ -32,8 +32,8 @@ impl Debug for Function {
#[derive(Debug, Clone, Default)]
pub struct Scope {
pub variables: HashMap<String, ValueInner>,
pub functions: HashMap<String, Function>,
variables: HashMap<String, ValueInner>,
functions: HashMap<String, Function>,
}
impl Scope {
@ -48,6 +48,11 @@ impl Scope {
self.variables.remove(&name);
}
}
pub fn add_fn(&mut self, name: &'static str, f: impl Fn(Vec<Value>) -> Value + 'static) {
self.functions
.insert(name.into(), Function::new(name.into(), f));
}
}
pub trait Eval {