Re: Why C# and Java have got it wrong
From: David Turner (david_at_firepro.co.za)
Date: 02/08/04
- Previous message: Walter: "Re: D gets it right"
- In reply to: Tomasz Zielonka: "Re: Why C# and Java have got it wrong"
- Next in thread: Josh Sebastian: "Re: Why C# and Java have got it wrong"
- Reply: Josh Sebastian: "Re: Why C# and Java have got it wrong"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 8 Feb 2004 11:52:35 -0800
Hi Tomasz Zielonka
I'm going to quote you in reverse order, because I want to agree with
you before I disagree with you :-).
Tomasz Zielonka <t.zielonka@zodiac.mimuw.edu.pl> wrote in message news:<slrnc2c131.b3a.t.zielonka@zodiac.mimuw.edu.pl>...
> Be careful, there are GC languages other than Java. Some of them can
> even perform this kind of checking at compile time.
[snip]
> Perhaps GC doesn't give such a big advantage in Java and C#, but have
> you used any language which conveniently supports higher order functions
> and closures?
[snip]
> I agree that Java and C# got many things wrong. But please, don't try to
> extend your bad experience with them to all GCed language
> implementations.
You are perfectly correct, and I must apologize: garbage collection is
a Good Thing (applied in moderation), and I didn't intend to set
myself up in a position quite so opposed to it. Garbage collection is
not what I'm attacking; what I *am* attacking is the distraction from
the real problem that the inclusion of garbage collection in Java has
ultimately caused.
So for all the bad things I said or implied about garbage collection,
I'm sorry. I have no similar criticisms to apply to Lisp, Haskell,
Scheme, or any number of other gc languages.
> David Turner wrote:
> > If an object is to be disposed of, then we must be sure that there are
> > no references to it. That is the fundamental dangling reference
> > problem.
>
> In C++ you can dispose an object which is still referenced. Even if you
> use some smart technique like the one you presented, you can still leave
> a reference to the proxy object living on the stack.
I'm not 100% sure I know what you mean. Referenced how? Yes, it's
possible to return a *pointer* to an object in a local scope, and this
causes many people who are new to C++ endless headaches. Objects
returned by *reference*, however, are required to have their lifetimes
extended. As to the proxy object technique I described, as far as I'm
concerned it's perfectly safe - provided nobody tries to create a
proxy on the heap.
By the way, I'm not advocating C++ as a language that is somehow
"perfect"; I'm simply using it as an example of how things could be
better in Java and C#. An excellent example of why C++ is not perfect
has just arisen in the previous paragraph: I would like to be able to
prevent the use of the "new" keyword in certain contexts, and C++
doesn't make this possible.
Regards
David Turner
- Previous message: Walter: "Re: D gets it right"
- In reply to: Tomasz Zielonka: "Re: Why C# and Java have got it wrong"
- Next in thread: Josh Sebastian: "Re: Why C# and Java have got it wrong"
- Reply: Josh Sebastian: "Re: Why C# and Java have got it wrong"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|