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

fix: #498 allow Zero-sized strings in VM. #499

Merged

Conversation

dorianignee
Copy link
Contributor

The vm call String.new now only checks if size is negative, so that empty strings work as expected.

The vm call String.new now only checks if `size` is negative, so that empty strings work as expected.
@DavidSouther
Copy link
Collaborator

Who are we to say that a Jack programmer is allowed to create a string that is always empty? (The argument to String.new is the max size, not the initial size. The initial size is always zero. So calling String.new(0) in Jack (or push 0\ncall String.new 1 in VM) gives back a string that can never have any characters in it.)

@DavidSouther DavidSouther changed the title fix: #498 fix: #498 allow Zero-sized strings in VM. Nov 27, 2024
@DavidSouther DavidSouther merged commit 3ae683c into nand2tetris:main Nov 27, 2024
1 check passed
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.

2 participants