Skip to content

TypeParam for constants. #2304

Open
@zrho

Description

@zrho

hugr-model represents constants for a runtime type ?t as terms of the static type (core.const ?t). To ease the migration from JSON encoded to term encoded constants, we should add the ability to represent the type of constants in TypeParam.

This could be done, as it is in hugr-model, via custom constructors. However, to avoid having to figure out custom TypeParams first (#2296), we can special case this (for now) as follows:

pub enum TypeParam {
    // ...

    /// The type of runtime constants.
    Const {
        runtime_type: Type,
    }
}

In particular, resolving this issue would require:

  • Add a Const variant to TypeParam as above.
  • Add a ConstTypeParam to the Python bindings.
  • Write the Rust model to core import code that imports (core.const ?t) as TypeParam::Const.
  • Write the Rustcore to model export code that exports TypeParam::Const to (core.const ?t).
  • Write the Python core to model export code that exports ConstTypeParam to (core.const ?t).
  • Update the spec accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions