-
Notifications
You must be signed in to change notification settings - Fork 13
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
fix: memory management #6
Conversation
class MemorySegmentManager { | ||
segmentSizes: Record<number, number>; | ||
export class MemorySegmentManager { | ||
segmentSizes: Record<Uint, Uint>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general:
If you have a static set of keys or you want a type that behaves like a regular object but with type safety, Record is a good choice.
If you want a dynamic collection of key-value pairs with more utility methods and insertion order, then Map is the way to go.
Lastly, considering the branding on Uint, if you were to use the Record, keep in mind that object keys in JavaScript are always strings, so there might be some nuances with key conversion if you try to use the branded number directly as a key.
@@ -41,7 +41,7 @@ export class Felt { | |||
} | |||
|
|||
toNumber(): number { | |||
let num = Number(this.inner); | |||
const num = Number(this.inner); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch
Fixes couple of issues in the memory, typos and adds couple of tests for the Memory.