Skip to content
Discussion options

You must be logged in to vote

Good question and very detailed eye ;)

Option 1 is what I use in my code. You can wrap the pattern with some utilities to make it safe and easy for the user. It works well in practice and I never needed anything else.

Memory policies sadly can't be used for this purpose the way they're currently designed. I could envision API changes that would allow it (basically allowing the implementation of option 1 under the hood), but as I just mentioned, the workaround was good enough for me.

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by nebularnoise
Comment options

You must be logged in to vote
7 replies
@nebularnoise
Comment options

@arximboldi
Comment options

@arximboldi
Comment options

@nebularnoise
Comment options

@nebularnoise
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants