Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a language with RAII + Ref counting that does not have unsafe pointer arithmetric?

RAII = Resource Acquisition is Initialization

Ref Counting = "poor man's GC"

Together, they are quite powerful (like a ref-counted 3D object holding a VBO, which it throws frees when it's destructor is called).

Now, question is -- does RAII exist in any langauge besides C++? In particular, a language that does not allow pointer arithmetric / buffer overflows?

like image 293
anon Avatar asked Jan 17 '10 07:01

anon


Video Answer


2 Answers

D has RAII but still has pointer arithmetic :( BUT, you don't really have to use it. Please note getting D to work was a pain in the butt for me so IM JUST SAYING.

like image 113
David Stocking Avatar answered Oct 18 '22 05:10

David Stocking


While not exactly RAII, Python has the with statement and C# has the using statement.

like image 37
R Samuel Klatchko Avatar answered Oct 18 '22 05:10

R Samuel Klatchko