66 points · by mcantor · 16y ago · 46 comments
Nowadays, my first choice is usually a mix of Lua and C, but I've learned a ton from every language along the way. C is useful for many things, but it's probably a terrible first language - until you have a fair amount of experience, there are just too many aspects of it that will bite you in the ass. Pointers are sharp tools, the type system is a joke, etc.
* Quite literally, a mishmash of C and early C++. Hey, I was a kid learning from library books in the early nineties. That's what I think of when people say they program in "C/C++" - a naive mix of C and C++.
I guess this kind of upsets me, but whatever. It's his own life he's wasting.
(Don't get me started on writing a compiler in C. Then I really will get mad.)
How about just one core library that does something useful and irreplacable on a modern system, and that works significantly better than the dinosaur code you keep complaining about? We've seen enough toy implementations and cute hacks (and, gack, web frameworks!) to last a lifetime.
How about a clean, bug-free and parallel implementation of zlib instead? Or a better h.264 codec? Or a crypto/TLS implementation that beats openssl? Regular expression engine better than pcre? World-class numerics library? GUI framework? SVG implementation? HTML parser? 3D modeling and rendering framework? ... Anything that isn't mostly a joke compared to the standard C junk you keep sneering at?
Seriously guys: get off your butts and write some real software. Most of us tolerate the sniping most of the time, but this bit was just over the line, sorry.
Oh.
Please let us know when it is ready ;-)
I mean, I know Haskell isn't the answer to everything (what is?), but this is a very odd complaint.
We all hacked around with other languages and implementations. And when we needed some fast and efficient little "thing" to plug in we went to the "C guy".
He was by far the most important guy for all the teams there :) (save me countless hours in writing a non-crucial but useful optimized array sorting algorithm to work with our program)
2. Programmer switches languages to one well-suited to the domain and his current knowledge.
3. Miraculously, the domain's previous speed and abstraction munging issues suddenly disappear.
Why is this news?
Use the right tool for the right job. Syntax matters. Baked-In abstractions matter. Standardized library interfaces matter. This is precisely why the number of programming languages has grown, not shrunk, over time.
For the most part, programming languages aren't "better" or "worse"; than each other; they're simply "different".
Let that same programmer attempt to leverage C against an entirely different problem domain, such as a 3D physics simulation, and watch how rapidly the language's merits suddenly dissolve.
(C would definitely not be my first choice for a compiler, though.)
For most of the rest it's possible to start in C and link in the language runtime, it's much easier to start in the runtime and extend it with C modules. From experience this is especially true for Python: I've used both ctypes and SWIG to turn the guts of existing native programs into Python libraries. I'm sure it's probably the case for Ruby and Perl as well.
You could also just use Go by itself :)
As a bonus, the border between the two languages often settles along conceptual seams in the codebase -- your low-level graphics rendering code shouldn't be tangled up with your enemy AI or UI templates, for example.
Rather than writing everything in a language that tries to do everything and winds a mess (C++), you can use two smaller, more focused languages.
You would take your C+Python app and rewrite the C bits in C++ and find it shorter and clearer and the same speed.
My memories of that book are mostly positive.
As part of a series, "Modern Compiler Implementation in..." the C version came across as a poor translation. I would say this is akin to Sedgewick's earlier version of his "Algorithms in..." texts, of which one was high quality but the translations were not. Where Sedgewick seems to have first written in Pascal, Appel seems to have first written in Java.
The constructs that Appel places on top of C to make implementation discussions easier did not help. While they attempted to make it object oriented, they made it messy and not "C" friendly.
For the basics, I kept referring to the Dragon book for better explanations then were provided there. I did not find it encouraging that this book drove me to the text it is trying to out-date.
I had bought it for the last half, since texts on modern compiler design are rare (functional languages, optimizations, garbage collection). But I recall the algorithms discussion to be subpar in that it was neither clear nor deep.
I still like the idea of structuring a compiler book around the semester long project of building one from the ground up. However, I think both the Tiger language and this text could have used another year of revision.
And if you already know how to write a lexer and a parser, "The Implementation of Functional Programming Languages" by Simon Peyton Jones is worth reading.
Given that Appel works on SML/NJ, I think the ML one is probably a better choice. (That one's really good, IHMO. Haven't read the other two.)
There aren't a whole lot of books specifically about GC, but I really like Richard Jones's _Garbage Collection: Algorithms for Automatic Dynamic Memory Management_.
Uhh... what does this mean?
I forget that subtle humor doesn't work on the web. ;)
As Paul Graham has written, Hacker News is an experiment in social news/networking—can a social news site continue to keep a high standard of discourse despite increasing population? If HN follows the Reddit path, then it seems PG failed.