~sircmpwn/hare-rfc

Re: [RFC] Generalizing default initializers and adding unsafe initializers

Details
Message ID
<80f1bb56ae18b4051a1f734b357950163c293a4d@rosiesworkshop.net>
DKIM signature
pass
Download raw message
Im very excited to see this proposal!

> For example, it is often necessary to statically allocate
> variables whose initializers cannot be evaluated at compile-time,

Another case where ^this^ has been true for me is when initializing
global unstable (exported but undocumented) structs. I recently wrote
the following to interface with debug:: and debug::image:


```
def self: *image::image = &self_buf: *image::image;

let self_buf: [size(image::image)]u8 = [0...];

@init fn self() void = {
        *self = image::self()!;
};
```

> 1. Should it zero the underlying memory, or leave it undefined?

I think making `...!` should zero the memory, as I did manually above.

Cheers,
RKL
Reply to thread Export thread (mbox)