Add ReferenceStorage for manual allocation of references#14106
Add ReferenceStorage for manual allocation of references#14106straight-shoota merged 7 commits intocrystal-lang:masterfrom
ReferenceStorage for manual allocation of references#14106Conversation
ReferenceStorage(T) for manual allocation of TReferenceStorage for manual allocation of references
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
straight-shoota
left a comment
There was a problem hiding this comment.
LGTM.
As mentioned in the OP, naming is still kind of preliminary. But in absence of any really clever idea, we can just take ReferenceStorage.
In case there is something inherently wrong about it, we can still change it as it's marked as experimental.
|
What about the minimal implementations for |
|
Not sure... Maybe we could leave them out for now and add them later if we notice they're missing? It's easy to patch them in ad-hoc, so this isn't holding up anything. I suppose instances of just_some_variable_to_put_this_on_the_stack = uninitialized ReferenceStorage(Foo)
foo = Foo.pre_initialize(pointerof(just_some_variable_to_put_this_on_the_stack))And Probably, this pattern will be abstracted away in a macro for convenience, further reducing direct usage of |
|
The problem is |
|
Sounds good. Let's keep it then 👍 |
…rystal-lang#14106)" This reverts commit 15010d3.
This adds the
Instancetype mentioned in #13481. The naming is not final.