Skip to content
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

refactor: major refactor of byte_type #21

Merged
merged 99 commits into from
Jan 5, 2024

Conversation

MierenManz
Copy link
Collaborator

@MierenManz MierenManz commented Oct 28, 2023

Some mega changes have been made.

  1. Types are now based off any of the following three two types Sized or Unsized. They inherit eachother, so Sized types are also Unsized. Meaning that they will help with type strictness.
  2. All types now can be readPacked, writePacked, read and write
    3. Compound types like structs, arrays, tuples and unions can also be written or read as packed meaning it reads the least amount of bytes necessary (not relevant anymore)
  3. A new compound type has been added called TaggedUnion
  4. Structs have been simplified into 1 class. It implements both Aligned and Packed meaning it can be read and written in all the ways possible (not relevant anymore)

TODO's for later pr's:

  1. Deno.Pointer
  2. Range checks Done
  3. Tests
  4. Benchmark harness
  5. Sub byte ints (u2 / u4)
  6. Bring back Viewable types.
  7. Add Sized compound types for Viewable structs etc (lazy reading / writing)
  8. 128 bit types

src/compound/tagged_union.ts Outdated Show resolved Hide resolved
src/compound/tagged_union.ts Outdated Show resolved Hide resolved
@MierenManz
Copy link
Collaborator Author

The last few commits also added type checking on the tagged union discriminant. If you have string keys you need to specify a codec. If it's integers you may specify what type of integer (bigint / 64 bit ints are not supported). Also floats can break the typecheck but I wouldn't know how to fix that. (also doesn't make sense to use floats as discriminant)

Copy link

@lino-levan lino-levan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. One nit.

src/array/typed_array.ts Show resolved Hide resolved
@load1n9 load1n9 self-assigned this Jan 4, 2024
@load1n9 load1n9 self-requested a review January 4, 2024 23:53
Copy link
Member

@load1n9 load1n9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@eliassjogreen eliassjogreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can still see lot's of improvements and changes but for now this looks great! Thank you!

@eliassjogreen eliassjogreen changed the title [Major] Refactored byte_type refactor: major refactor of byte_type Jan 5, 2024
@eliassjogreen eliassjogreen merged commit 796f19a into denosaurs:main Jan 5, 2024
2 checks passed
@MierenManz
Copy link
Collaborator Author

I can still see lot's of improvements and changes but for now this looks great! Thank you!

We can discuss those on discord soon ish maybe? I have some more changes that I want to make to taggedunion for example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants