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

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
Show resolved Hide resolved src/box.cr Outdated
Show resolved Hide resolved src/box.cr Outdated
Show resolved Hide resolved spec/std/box_spec.cr Outdated
@RX14

RX14 approved these changes Jul 31, 2019

@waj waj force-pushed the waj:feature/reference-box branch from a40f01b to 3588a91 Jul 31, 2019

@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

5 checks passed

ci/circleci: check_format Your tests passed on CircleCI!
Details
ci/circleci: test_darwin Your tests passed on CircleCI!
Details
ci/circleci: test_linux Your tests passed on CircleCI!
Details
ci/circleci: test_linux32 Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@waj waj deleted the waj:feature/reference-box branch Jul 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.