Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.
This repository was archived by the owner on Jul 29, 2026. It is now read-only.

Create trait for builtins #227

Description

@mimoo

we should standardize how we write builtins by using some trait that looks like this or something:

trait Builtin {
    const sig: &'static str;

    const no_typecheck: bool;

    fn typecheck(
        generics: &GenericParameters,
        vars: &[VarInfo<F, LinearCombination<F>>],
        span: Span,
    ) -> Result<()>;

    fn builtin(
        compiler: &mut CircuitWriter<R1CS<F>>,
        _generics: &GenericParameters,
        vars: &[VarInfo<F, LinearCombination<F>>],
        span: Span,
    ) -> Result<Option<Var<F, LinearCombination<F>>>>;
}

and the typecheck() function could contain all of the actual checks that need to be done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions