Shouldn't invalid references like this fail at compile time?
H. S. Teoh
hsteoh at quickfur.ath.cx
Fri Jan 26 17:33:55 UTC 2018
On Fri, Jan 26, 2018 at 04:36:18AM -0700, Jonathan M Davis via Digitalmars-d wrote:
> On Thursday, January 25, 2018 17:20:21 H. S. Teoh via Digitalmars-d wrote:
> > On Fri, Jan 26, 2018 at 01:08:10AM +0000, Mike Franklin via Digitalmars-d
> wrote:
> > > On Wednesday, 24 January 2018 at 09:35:44 UTC, lobo wrote:
> > > > And I'm broken after using D, going back to C++ is awful and
> > > > Rust just has too much friction to be enjoyable.
> > >
> > > Yep, I know exactly what you mean.
> >
> > Me Too (tm). After having gotten used to D, working with C/C++ (or
> > just about any other language, really) is just extremely painful.
> > Unfortunately, I have no choice because my day job requires C/C++.
> > D has officially ruined my life. :-D
>
> Well at least you don't have to program in Java. :)
>
> Unless something has changed in one of the recent versions, you can't
> even write a swap function in Java. :|
I haven't touched Java in a long while, but the last time I looked, it
wasn't too horrible of a language. Needlessly verbose, yes. Breaks DRY,
yes. Shoehorns everything into an OO model, even where it doesn't fit,
yes. But in terms of the language itself, it's kinda pretty in its own
way, even if it's in an idealistic, detached-from-the-real-world kind of
way. At least you're not worried about buffer overruns, memory leaks,
and inscrutible pointer bugs that could literally be *anywhere* in the
entire 20,000-file codebase.
Overall, I'd say Java is an OK language, not horrible, but not that
great either. The only thing that makes it shine is really the wealth of
libraries out there that you can draw from. I'd rate it as a "meh",
whereas C is pretty horrible in spite of being extremely powerful, and
C++ is just masochistic (though I confess I haven't looked into its
latest incarnations -- the C++ code I have to work with dates back to
C++98 and probably isn't going to change anytime in the foreseeable
future).
> It's definitely painful to have to program in C++ after programming in
> D, but I still find C++ to be more pleasant than the alternatives
> other than D.
[...]
I'm torn between whether C or C++ is worse. In some ways, I actually
prefer C because the language is smaller, the semantics are more
straightforward, and the potential dangers are well-known and
well-studied. It doesn't lessen the pain, but at least you have
well-established maps with which to navigate through the minefield.
C++, OTOH... perhaps my opinion is biased by having had the misfortune
of working with an overengineered, overdesigned C++ codebase that
exemplified all the flaws of C++ and none of its advantages (thankfully,
said codebase has been replaced... good riddance *shudder*). But when
you're dealing with code where useful work is done inside dtors and
where making a conceptual function call involves 6 layers of
abstraction, one step of which involves fwrite()'ing parameters into a
temporary file and fread()'ing from the other end, the only thing that
can possibly come to mind is "where's my 10-foot pole and why am I not
using it", and "is it even humanly possible to understand what this code
actually does?!". C++ is just far too big, far too complex for any
mortal to fully comprehend, and that's not even beginning to touch the
semantics of a convoluted codebase that abuses the language in every
possible way. No thanks, if I had the choice, I'm staying away from C++
as far as I possibly can.
T
--
MAS = Mana Ada Sistem?
More information about the Digitalmars-d
mailing list