Skip to main content

decode_eval_expr_with_codec

Function decode_eval_expr_with_codec 

Source
pub fn decode_eval_expr_with_codec(
    cx: &mut Cx,
    symbol: &Symbol,
    input: Input,
    read_policy: ReadPolicy,
) -> Result<Expr>
Expand description

Decode input to an evaluable [Expr], applying the codec’s eval-surface lowering (a lisp (f x) becomes a [Expr::Call]) but WITHOUT the Term/Datum round-trip that decode_term_with_codec performs.

The Term lowering forces every Expr::List to a pure Datum, which fails (expected datum expression, found call expression) when a list legitimately contains a non-datum sub-form – e.g. a let binding container ((x 5)) whose clause (x 5) eval-lowers to a call, or a match clause. Evaluating the eval-lowered Expr directly preserves that structure so a special form receives its raw structural argument and interprets it (call- or list-shaped clauses are both accepted by the organ forms). For plain function calls this is behaviour-identical to decode_term_with_codec followed by Expr::from.