One thing about D is that you have full control over the garbage
collections.    You can turn off garbage collection and use malloc and
free if you want,   or you can control when it's collected.

You can also use garbage collection with C / C++ by using the publicly
available and popular Boehm garbage collector.

I have to say it's not a big deal for me.   I have never had trouble
with garbage collectors.    Part of the reason is that I try to avoid
using malloc in my C programs,  but even when I've used it heavily I've
not had trouble.    I keep reading that it's a huge source of trouble
and bugs that are hard to find, etc.      I can only imagine that this
is caused by programs that are "malloc happy" with little structure or
poorly written.      I've had more trouble with forgetting to fclose a
file that was fopened which is a similar problem. 

I've written software that has structs that are malloc'd and some of the
struct members are malloc'd too.   Non-trivial programs.  I don't see
what the big deal is.       

Having said that,  I still like having garbage collection.   I just hope
it doesn't make me lazy!

- Don


Nick Wedd wrote:
> In message
> <[EMAIL PROTECTED]>, Nick
> Apperson <[EMAIL PROTECTED]> writes
>> WARNING: This digresses into a rant by the end...  You've been warned.
>>
>> If you like to have your garbage collected for you then use one of the
>> management strategies present in C++.  If you like delayed freeing,
>> overload new or use a library that does this.  Really, the difference
>> between C++ and most other programming languages (that are strongly
>> typed) is that C++ doesn't make any assumptions about what you are
>> going to do with it because of its most basic principle: you don't pay
>> for what you don't use.  If you want garbage collection, you can have
>> it: it's not like C++ prevents this.  By the same token, Java and C#
>> don't allow you to make any decision here which might be best in
>> certain circumstances, but it certianly isn't always ideal.  If you
>> want the subset of features that say java has, you are welcome to
>> create these restrictions in C++ all while remaining more portable.
>> I personally use garbage collection every once in a while in my C++
>> code.  It is not usually the right tool for me, but there are
>> circumstances where it makes sense.  I generally use it when I have
>> data that isn't really owned by any object.  It is data that many parts
>> of the program reference and some wish to keep a copy for themselves. 
>> This is how the std::string class is implemented in C++.  Reference
>> counting and copy on write.
>> But I'll be damned if Java takes over the world because there are
>> programmers that don't know when they need to use garbage collection. 
>> If you can't avoid memory leaks, fine, don't use C++ or C, but don't
>> blame the language.  You could use garbage collection if you need it;
>> don't make us all stoop to your level of competency and don't try and
>> claim that your language is just as fast when it isn't.
>> - Nick
>
> I read this to the end, looking forward to finding a good rant.  But
> everything you have said is entirely reasonable.
>
> Nick
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Reply via email to