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

Improve Box of reference types #8016

Merged
merged 1 commit into from
Jul 31, 2019

Conversation

waj
Copy link
Member

@waj waj commented Jul 30, 2019

Right now Box(T) always allocates memory to create a box for any object. With these changes it only allocates memory for value types.

For example:

Box.box(123)   # => Pointer(Void)@0x104a29ff0
Box.box(nil)   # => Pointer(Void).null

foo = Foo.new  # => #<Foo:0x10b1b7ff0>
Box.box(foo)   # => Pointer(Void)@0x10b1b7ff0

@waj waj force-pushed the feature/reference-box branch from a40f01b to 3588a91 Compare July 31, 2019 14:57
@bcardiff bcardiff added this to the 0.30.0 milestone Jul 31, 2019
@bcardiff bcardiff merged commit 9dc7daf into crystal-lang:master Jul 31, 2019
@waj waj deleted the feature/reference-box branch July 31, 2019 17:18
dnamsons pushed a commit to dnamsons/crystal that referenced this pull request Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants