|
51 | 51 | //! - Some terms can not yet be represented in `hugr-core` although they should be. |
52 | 52 | //! Importing such terms will result in an error that declares these terms as currently |
53 | 53 | //! unsupported. |
54 | | -//! - In particular `hugr-core` currently only allows to define custom runtime types but |
| 54 | +//! - In particular `hugr-core` (as of `v0.22.3`) only allows to define custom runtime types but |
55 | 55 | //! can not represent custom term constructors for static types. Implementing support for |
56 | 56 | //! static `Term`s in `hugr-core` will allow to use the term system for extensible metadata |
57 | 57 | //! and constants. Once that is implemented, the hugr IR will have a unified extension mechanism. |
|
64 | 64 | //! compatibility mechanism via the `compat.const_json` constant constructor but also allows |
65 | 65 | //! to declare custom constant constructors. Import/export has hard-coded support for a small |
66 | 66 | //! fixed set of these for now. |
| 67 | +//! - In `hugr-core` a constant is a `Value`, included in the hugr graph via a `Const` node. |
| 68 | +//! A `LoadConst` node connects to the `Const` node via a static edge. `Value`s are separate |
| 69 | +//! from `Term`s in `hugr-core` and can not refer to local variables or to function nodes. |
| 70 | +//! In `hugr-model` the `Const` node is not needed: The `core.load_const` operation takes |
| 71 | +//! the constant's description as a term argument. This enables `hugr-model` constants to |
| 72 | +//! depend on local variables and to refer to functions in the module (removing the need |
| 73 | +//! for a separate `LoadFunc` operation). |
| 74 | +//! - `Value`s in `hugr-core` have a single representation for every constant. The encoding |
| 75 | +//! of constants as terms in `hugr-model` can use different constructors for the same type |
| 76 | +//! of constant value. This can be useful for large constants by enabling efficient encodings. |
| 77 | +//! For example, a constant array of integers could have a constructor taking a byte string |
| 78 | +//! that consists of the integer values, which is significantly more economical than a generic |
| 79 | +//! representation of arrays that has a term for every element. |
67 | 80 | //! - The model does not have types with a copy bound as `hugr-core` does, and instead uses |
68 | 81 | //! a more general form of type constraints ([#1556]). Similarly, the model does not have |
69 | 82 | //! bounded naturals. We perform a conversion for compatibility where possible, but this does |
|
79 | 92 | //! - `hugr-core` only allows to define type aliases, but not aliases for other terms. The |
80 | 93 | //! alias system is under-developed in both `hugr-core` and `hugr-model` and will need some |
81 | 94 | //! considerable design and implementation work (or to be removed if deemed unnecessary). |
| 95 | +//! See [#2558]. |
82 | 96 | //! |
83 | 97 | //! [#1556]: https://github.com/CQCL/hugr/discussions/1556 |
| 98 | +//! [#2558]: https://github.com/CQCL/hugr/issues/2558 |
84 | 99 | //! [Text]: crate::v0::ast |
85 | 100 | //! [Binary]: crate::v0::binary |
86 | 101 | //! [Table]: crate::v0::table |
|
0 commit comments