Re: [OT] Re: C++ *for Git*

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linus Torvalds <torvalds@...>
Cc: Marco Costalba <mcostalba@...>, Pierre Habouzit <madcoder@...>, David Kastrup <dak@...>, Frank Lichtenheld <frank@...>, Alex Unleashed <alex@...>, Kyle Rose <krose@...>, Miles Bader <miles@...>, Dmitry Kakurin <dmitry.kakurin@...>, Git <git@...>
Date: Sunday, September 23, 2007 - 5:22 pm

On Sun, Sep 23, 2007 at 09:54:10AM -0700, Linus Torvalds wrote:

Certainly, in this respect, C++ provides only syntactic sugar over C,
and there is a real danger of abuse, which leads to horrible programs.
This is especially likely to happen to those who think that the evil
of C++ is lying in templates, exceptions, or something other feature
of C++, because they start to abuse the only "good" feature they know
and inevitably end up with horrible code.


user_ptr<somestruct> p;


Whether it will convert to something or not depends entirely on the
definition of user_ptr. So, it can be as explicit as you wish, or
completely implicit. C++ does not impose anything on you here. So,
the problem is not in C++ but in the crappy mentality -- "let's hide
everything behind 'higher' abstraction" or "let's hide this thing too
because we can". Yes, these people end up with total crap. And yes,
those people tend to prefer C++ over C, just because C++ is better at
hiding. But I don't think that C++ forces anyone to do that...


Stroustrup was not a big fan of GC, so he made the language to be useful
in absence of any GC, and it allows to manage memory and some other
resources though not automatically, but with much less efforts than in C.

Maybe, your idea of more explicit GC is better than what C++ offers. It
is difficult for me to say without trying, but as you said most languages
implement GC in the wrong way in your opinion, so I don't think I will
have a chance to try any language that does it right. As to "caches" in
Git, it works really nicely, but Git is not a programming language.


It could do a lot of things implicitly, but it does not force you,
except calling destructor when the control leaves the scope of
declaration, but I hardly can consider it as implicit.


Perhaps, you look at it from the kernel point of view. Otherwise, I
would like to hear your arguments against it. In fact, I don't think
it is possible to write generic algorithms without exceptions. Of
course, if you write a program that can print an error to stderr and
exit, there is no much need for them. So, it may depend on the task.


I am not sure what is wrong with initializers and destructors in C++,
but certainly there is no magic lifetime rules in C++, as it is fully
determined by the scope. In fact, other high level languages that use
GC have much more unpredictable lifetime rules for objects.


Dmitry Potapov

PS Please, do not confuse me with Dmitry Kakurin, who started this
thread, because my position is opposite to his. Though I like C++,
I fully understand most of your consideration in choosing C for Git.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[OT] Re: C++ *for Git*, Kyle Rose, (Sat Sep 22, 2:25 pm)
Re: [OT] Re: C++ *for Git*, Alex Unleashed, (Sat Sep 22, 6:50 pm)
Re: [OT] Re: C++ *for Git*, Frank Lichtenheld, (Sat Sep 22, 10:09 pm)
Re: [OT] Re: C++ *for Git*, David Brown, (Sun Sep 23, 2:25 am)
Re: [OT] Re: C++ *for Git*, David Kastrup, (Sun Sep 23, 3:23 am)
Re: [OT] Re: C++ *for Git*, Marco Costalba, (Sun Sep 23, 5:29 am)
Re: [OT] Re: C++ *for Git*, Pierre Habouzit, (Sun Sep 23, 6:45 am)
Re: [OT] Re: C++ *for Git*, Marco Costalba, (Sun Sep 23, 9:42 am)
Re: [OT] Re: C++ *for Git*, Linus Torvalds, (Sun Sep 23, 12:54 pm)
Re: [OT] Re: C++ *for Git*, Dmitry Potapov, (Sun Sep 23, 5:22 pm)
Re: [OT] Re: C++ *for Git*, Reece Dunn, (Sun Sep 23, 6:25 pm)
Re: [OT] Re: C++ *for Git*, Dmitry Potapov, (Mon Sep 24, 6:46 am)
Re: [OT] Re: C++ *for Git*, David Kastrup, (Sun Sep 23, 5:31 pm)
Re: [OT] Re: C++ *for Git*, Robin Rosenberg, (Sun Sep 23, 7:10 pm)
Re: [OT] Re: C++ *for Git*, Marco Costalba, (Sun Sep 23, 2:05 pm)
Re: [OT] Re: C++ *for Git*, David Kastrup, (Sun Sep 23, 2:30 pm)
Re: [OT] Re: C++ *for Git*, Marco Costalba, (Sun Sep 23, 2:43 pm)
Re: [OT] Re: C++ *for Git*, David Kastrup, (Sun Sep 23, 3:11 pm)
Re: [OT] Re: C++ *for Git*, David Kastrup, (Sun Sep 23, 10:37 am)
Re: [OT] Re: C++ *for Git*, Paul Franz, (Sun Sep 23, 1:49 pm)
Re: [OT] Re: C++ *for Git*, Marco Costalba, (Sun Sep 23, 11:15 am)
Re: [OT] Re: C++ *for Git*, Nicolas Pitre, (Sun Sep 23, 10:23 am)
Re: [OT] Re: C++ *for Git*, Marco Costalba, (Sun Sep 23, 10:45 am)
Re: [OT] Re: C++ *for Git*, David Kastrup, (Sun Sep 23, 5:42 am)
Re: [OT] Re: C++ *for Git*, Marco Costalba, (Sun Sep 23, 5:50 am)
Re: [OT] Re: C++ *for Git*, David Kastrup, (Sat Sep 22, 3:11 pm)