-
Notifications
You must be signed in to change notification settings - Fork 13
refactor!(hugrv2): WIP+RFC: Unify Type and Term #2785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: acl/no_1type_row
Are you sure you want to change the base?
Conversation
…conversion to types.rs
This reverts commit 3aad2180f710237a31fc67e5995a2f607d9f0168.
|
Hey there and thank you for opening this pull request! 👋 We follow the Conventional Commits convention for PR titles. It looks like your title needs some adjustment. The title should have a type prefix, followed by a colon. The most important ones are:
If the PR contains a breaking change, use You may also include a Expand this message for the full list of tags.
|
Follows #2784; closes #2341
Term::ListConcatwhich is a much nicer/more-principled solution.Term::new_list_concat) was not that great so I have reverted...thoughts?type Type/TypeRV = Term; removeTerm::Runtime(Type)and add new Term constructors corresponding to the old ones in Type:Term::RuntimeFunction,Term::RuntimeSumandTerm::RuntimeExtension.::Extension, i.e. able to produce things that are not just runtime types....Term::ListType(Term::RuntimeType)) which could thus contain variables ranging over lists (RVs).This is mostly pain, the bigger gains are expected to come in later PRs (#2296 and #2756, eventually allowing "inspectable" custom constants with efficient serialization). But perhaps removing the RV hack is a win.
It's a draft, things are not all working yet....
Arbitrary.TODOs/unresolved questions:
TypeArg,TypeParamand the newTypeRV,Type,TypeRowRV?Term::XXXTypetoXXXKind, and allTerm::RuntimeYYYto::YYYType(so Term::SumType, Term::ExtensionType, Term::FunctionType). Using the word "type" to mean types at the static/Term level rather than runtime (wire) types seems confusing.new,try_newandnew_uncheckedwere a big help in debugging, getting back some of what was lost by the unification of Type-Term and RV-NoRV. I suspect we should extend this to all OpType variants - ExtensionOp, Call, and LoadFunction have always done these checks, so we could add to Input, Output, containers, etc. etc. too (?)BREAKING CHANGE: Term gains
RuntimeFunction,RuntimeSumandRuntimeExtensionvariants; Type is now an alias for Term. Usecheck_term_type(tm, &TypeBound::Linear.into())to check thattm: &Termrepresents a runtime type. No more aliases.