Is it safe to use Modify Accessors?

I've come across a use case where Modify Accessors would dramatically increase the readability of an API I'm developing. I understand that this has not yet gone through Evolution but, having now been in use in the standard library for a while, is there anything I need to be aware of before I ship production code using _modify and yield?

This modify feature is currently available (but not supported) from Swift 5.0 as _modify , for experimentation purposes when reviewing this proposal.

Specifically, I'm unsure of the difference between "available" and "supported" in this context.

Available means that you can write code today that will behave more or less as expected. Unsupported means the code may cease to compile, or may compile but behave differently, at any point in the future and without notice. This is likely why it’s said to be available “for experimentation purposes”; the lack of any promise that it will continue to work would make it unsuitable for production code unless you’re willing to commit to reworking that code in tandem with any changes in Swift (as is the case for the standard library).

1 Like
Terms of Service

Privacy Policy

Cookie Policy