From b1d0db5ea491889b316b5d73ae5e339b20018333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 2 Jan 2023 15:54:50 +0100 Subject: [PATCH] Interpreter - Callable interface definition --- src/interpreter/callable.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/interpreter/callable.rs diff --git a/src/interpreter/callable.rs b/src/interpreter/callable.rs new file mode 100644 index 0000000..c82922d --- /dev/null +++ b/src/interpreter/callable.rs @@ -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, + ) -> Result; +}