Ok, so I picked up Visual C# about 20 minutes ago, and it seems to be the ultimate in faggotry:
"You may already know about destructors if you have used C++. Because of the automatic garbage collection system in C#, it is not likely that you will ever have to implement a destructor unless your class uses unmanaged resources"
Even objectPascal wasn't this gay.
Name:
Anonymous2007-07-16 11:16 ID:a4IW55Uz
Yeah destructors in C# are pretty pointless.
Worse than pointless in fact because C++ programmers use destructors to tidy up things like open files and database connections. In C++ the destructor gets called as soon as the object goes out of scope. If they try to do this in C# they'll have open connections lying around until the garbage collector feels like doing its job.
Name:
Anonymous2007-07-16 11:25 ID:EEzO5dcf
Fuck objectpascal, it's ada with a c-style syntax.
There's no fundamental reason why RAII can't be used with GC. I'd love to hear your reasons why you think this is so. If C# doesn't support it, that's C#'s fault.
HAHAHAHwhat? You kidding, right? Who the fuck thought of that? See it properly implemented in Python:
text = file('lol').read()
#Open file lol, call read(), since the file isn't stored, it's immediately garbage collected. File's destructor closes the file.
class lol(object):
def __init__(self, x):
self.x = x
def __del__(self):
print 'Hi, I am a destructor. I work with the GC, but I also work when called by hand, so you can do whatever suits you.'
print 'Destroying object', self.x
o = lol(1)
o = lol(2) #lol(1) is destroyed
del o #lol(2) is destroyed by hand
Name:
Anonymous2007-07-16 14:25 ID:0HXA0mPP
>>8
You really think GC in that code snippet works like GC in a heavy/huge application?
>>8
I want to bash too!
btw, if you want a nice way to dispose resources, try (with-open-file ...)
Name:
Anonymous2007-07-16 19:37 ID:yUz0+9zB
>>9
Python's GC works really good, and doesn't have the ugly stuttering issues you can see in Java applications that may halt for many tenths of a second while the GC runs. And if it doesn't work as you want, there's even an alternative GC you can try. Or you can call del to remove references by hand (thus forcing the GC to collect something if it was lazy about it).
Name:
Anonymous2007-07-16 20:31 ID:eZeZ20jU
>>13
THE FORCED LACK OF GOOD FILE HANDLING, THREAD OVER
Name:
Anonymous2007-07-17 0:00 ID:mXkJJsHX
Man, comparing Python's GC with Java's is just... plain idiotic.
The Java language is an absolute POS, but the JVM is nearly beyond approach. You're a clueless fanboy.