core: move top level def type vars into PrimitiveStore #418

Closed
lyken wants to merge 2 commits from refactor-primstore into master
Collaborator
  1. Top level TypeVars option_type_tvar, ndarray_ndims_tvar, and ndarray_dtype_tvar are now captured by PrimitiveStore. This is to eliminate code that does, say, let ndarray_ndims = *ndarray_params.iter().nth(1).unwrap(), which is incoherent.
  2. Changed unpack_ndarray_var_tys to unpack_ndarray_params after (1.).
1. Top level `TypeVar`s `option_type_tvar`, `ndarray_ndims_tvar`, and `ndarray_dtype_tvar` are now captured by `PrimitiveStore`. This is to eliminate code that does, say, `let ndarray_ndims = *ndarray_params.iter().nth(1).unwrap()`, which is incoherent. 2. Changed `unpack_ndarray_var_tys` to `unpack_ndarray_params` after (1.).
lyken added 1 commit 2024-06-17 11:53:51 +08:00
lyken requested review from derppening 2024-06-17 12:00:12 +08:00
lyken force-pushed refactor-primstore from df1bd467fc to 31cd6c3792 2024-06-17 12:04:13 +08:00 Compare
Collaborator

Please break the formatting/clippy changes unrelated to the refactoring to a separate commit.

Please break the formatting/clippy changes unrelated to the refactoring to a separate commit.
derppening requested changes 2024-06-17 13:03:00 +08:00
@ -50,2 +52,4 @@
pub exception: Type,
pub option: Type,
/// The contained type of an `Option`
pub option_type_tvar: TypeVar,
Collaborator

I think it might be better if we just have OptionType and NDArrayType, effectively becoming something like

pub struct OptionType {
    pub ty: Type,
    type_tvar: TypeVar,
}

impl OptionType {
    fn subst(type: Type) -> OptionType {}

    fn unpack_type(option: Type) -> Type {}
}
I think it might be better if we just have `OptionType` and `NDArrayType`, effectively becoming something like ```rs pub struct OptionType { pub ty: Type, type_tvar: TypeVar, } impl OptionType { fn subst(type: Type) -> OptionType {} fn unpack_type(option: Type) -> Type {} } ```
lyken force-pushed refactor-primstore from 31cd6c3792 to 439a9977e0 2024-06-17 13:33:01 +08:00 Compare
lyken force-pushed refactor-primstore from 439a9977e0 to 4a81ca08d2 2024-06-17 13:35:00 +08:00 Compare
Author
Collaborator

Force-pushed to (hopefully) remove all clippy changes

Force-pushed to (hopefully) remove all clippy changes
lyken added 2 commits 2024-06-17 16:28:01 +08:00
lyken added 1 commit 2024-06-17 16:31:00 +08:00
lyken force-pushed refactor-primstore from 34b278a641 to 6a4ea1a1b3 2024-06-18 09:40:37 +08:00 Compare
sb10q requested review from derppening 2024-06-19 15:16:02 +08:00
derppening refused to review 2024-06-19 16:03:26 +08:00
Collaborator

Closing for now as I will take over this and make changes directly.

Closing for now as I will take over this and make changes directly.
derppening closed this pull request 2024-06-19 16:04:08 +08:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#418
No description provided.