Replies: 1 comment 4 replies
-
Hi @bscothern! Thanks for starting the discussion. I actually had this as an autoclosure earlier in the beta, but decided to scrap the complexity later on. While laziness could theoretically be helpful here, it does seem to go against the norm in Apple's APIs, for example That said we're open to discussing the change, we'd just like to figure out if it can be motivated in a more real world fashion. What kinds of things does the |
Beta Was this translation helpful? Give feedback.
-
Right at the end of the beta I started using the Shared features to do some development and had the idea of modifying
@Shared
's default value to be captured via@autoclosure
so it can lazily be created if there is no shared instance found rather than eagerly being made every time and then discarded when@Shared
finds the existing instance of the value.I have already put together a branch that does this with some tests to ensure it is lazy over in my own fork and it seems to work well from my bit of testing.
Here is my original comment about it in the beta discussion.
Beta Was this translation helpful? Give feedback.
All reactions