A trait ConcreteConcept can be defined to decouple evaluation logic for each concrete concept (let, :=, ->, etc.) by storing an optional dynamic ConcreteConcept trait object in each Concept.
Trait methods could include
fn initial_label(&self) -> &'static str; which can also be used to impl PartialEq for dyn ConcreteConcept
fn right_associative_infix(&self, left: &Arc<SyntaxTree>, rightright: &Arc<SyntaxTree>) -> Option<Arc<SyntaxTree>>; e.g. evaluating left -> rightright. Will actually need another parameter to access the context, maybe through the ContextSearch type.
A trait
ConcreteConcept
can be defined to decouple evaluation logic for each concrete concept (let
,:=
,->
, etc.) by storing an optional dynamicConcreteConcept
trait object in eachConcept
.Trait methods could include
fn initial_label(&self) -> &'static str;
which can also be used toimpl PartialEq for dyn ConcreteConcept
fn right_associative_infix(&self, left: &Arc<SyntaxTree>, rightright: &Arc<SyntaxTree>) -> Option<Arc<SyntaxTree>>;
e.g. evaluatingleft -> rightright
. Will actually need another parameter to access the context, maybe through theContextSearch
type.