-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There should be implemented a WeakPtr also #11
Comments
You can use a |
Yes I can, but also I can use ref instead of SmartPtr. |
I don't understand your point. Adding "unique" to Nim's type system would be much more work than a library solution, obviously. |
The point is that unique keyword in the Nim itself will add possibility to use any Nim supported type, not only pointers and make this library redundant. Also this lib lacks WeakPtr, which is obviously should be there. WeakPtr is not just pointer, it is a smart pointer too: it has use count, expiration, destructor and assignment ops and could be locked (converted atomically to SharedPtr). |
So add a WeakPtr, you don't have to lecture me what it is. My point was that the existing SharedPtr is far from useless as it is now and that many designs work with |
I'm just talking that adding unique kw to Nim itself will be better than porting some OOP solutions from C++ with all it's bugs and vulnerabilities (e.x. SharedPtr is unsafe in threading) to the language with very limited OOP. |
This code will leak because a refers to b and b refers to a and there's no possibility to fix this not using WeakPtr.
Also this code goes to infinite recursion in echos.
The text was updated successfully, but these errors were encountered: