Struct deinit

I found this pitch from forever ago: Pitch: Deinit for structs

Now that references and ownership are being worked on, does that mean deinit could finally be added to structs?

More powerful types without having to reach for reference counted classes sounds like a cool feature :slight_smile:


Yes, this has been discussed extensively in the proposals. See "Destructuring methods for move-only types with deinit" under Future Directions in SE-0366, for example. This is already partially supported behind a feature flag in the development toolchains (@Michael_Gottesman can tell you more on the implementation status).


Oh, cool :slight_smile:
Is that the -enable-experimental-move-only flag or something else?

It doesn't seem like this flag allows move only structs with deinit on the toolchain from yesterday, unless the keyword is somehow different for now

*yeah I was forgetting the _

It works thank you

1 Like

There are still plenty of rough edges to sand down, any bugs you might report are much appreciated.

1 Like

This was recently discussed here: