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

Add Reference.pre_initialize and .unsafe_construct #14108

Conversation

HertzDevil
Copy link
Contributor

See #13481.

This PR references ReferenceStorage from #14106 in documentation only. These methods are not defined on struct or value types, nor implemented inside the interpreter.

src/primitives.cr Outdated Show resolved Hide resolved
# otherwise all calls will refer to the sole instantiation in
# `Reference.class`. This is necessary when the receiver is a virtual
# metaclass type. Apparently this works even for primitives
{% @type %}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not entirely sure what to do with this. A fresh compiler will break if the existing compiler's version is below 1.2.0 and the compiler itself uses .pre_initialize / .unsafe_construct on a virtual metaclass. I don't think that is very likely, but if we must do it, the only solution seems to be explicitly defining .pre_initialize in every subclass of Reference in the compiler, similar to .allocate.

@HertzDevil HertzDevil marked this pull request as ready for review December 18, 2023 08:51
src/primitives.cr Outdated Show resolved Hide resolved
Co-authored-by: Johannes Müller <straightshoota@gmail.com>
@straight-shoota
Copy link
Member

@HertzDevil In case you missed it, I also left a comment on a previously resolved thread: #14108 (comment) WDYT?

@straight-shoota straight-shoota added this to the 1.11.0 milestone Dec 19, 2023
@straight-shoota straight-shoota merged commit b41fda9 into crystal-lang:master Dec 20, 2023
55 checks passed
@HertzDevil HertzDevil deleted the feature/reference-unsafe-construct branch December 21, 2023 10:40
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.

3 participants