I hope that by C++'s approach(unique_ptrs) you meant Rust's approach(smart 
unique pointers) because the former's way is neither safe(allows dangling 
pointers) nor nice(useless and verbose wrapper) nor efficient(allows leaks, 
requires extra steps to work with the data).

Having a single-alias reference(with a borrow checker), a counted reference and 
an atomically counted reference would be easier to implement than a good 
multi-threaded GC anyway and it would enable safe multi-threaded programming 
where I don't need to deal with the thread-local semantics. On the other hand, 
this would be only useful if Araq wants nim to be used for low-level 
programs(making it a Rust competitor where it'll most likely fail due to 
marketing reasons) because this approach is unnecessarily complex and doesn't 
bring enough value to web/application developers.

I think Araq wants that approach because it would be easier to implement 
because the safety analysis would be outsourced to static analysis tools:

"Dangling unowned refs cause a program abort and are not detected statically. 
However, in the longer run _I expect static analysis to catch up and find most 
problems statically_ , much like array indexing can be proved correct these 
days for the important cases."

Reply via email to