Interpreter - Callable interface definition
This commit is contained in:
parent
fecea3b388
commit
b1d0db5ea4
1 changed files with 13 additions and 0 deletions
13
src/interpreter/callable.rs
Normal file
13
src/interpreter/callable.rs
Normal 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>;
|
||||||
|
}
|
Loading…
Reference in a new issue