-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add Reference.pre_initialize
and .unsafe_construct
#14108
Conversation
src/primitives.cr
Outdated
# 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 %} |
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.
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
.
Co-authored-by: Johannes Müller <straightshoota@gmail.com>
@HertzDevil In case you missed it, I also left a comment on a previously resolved thread: #14108 (comment) WDYT? |
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.