Interpreter - Callable interface definition

This commit is contained in:
Emmanuel BENOîT 2023-01-02 15:54:50 +01:00
parent fecea3b388
commit b1d0db5ea4

View file

@ -0,0 +1,13 @@
/// A callable is some object that supports being called.
pub trait Callable {
/// Return the amount of arguments supported by the callable.
fn arity(&self) -> usize;
/// Run the callable in the execution environment with the specified
/// arguments.
fn call(
&self,
environment: &mut Environment,
arguments: &Vec<Value>,
) -> Result<Value, InterpreterError>;
}