4 ms·
I've recently realized that--at least to me--C is actually very much like Prolog. How? Well: Prolog is a fairly simple, Turing-complete language. For the things
by tikhonj 14y ago
I've recently realized that--at least to me--C is actually very much like Prolog. How? Well: Prolog is a fairly simple, Turing-complete language. For the things it's good for, it's great. But those things are few and relatively specialized. I could use Prolog for general-purpose programming, but I wouldn't want to. With Prolog, the question is always "why Prolog?" rather than "why not Prolog?". Sometimes there is a good answer to this, but usually there isn't. I can also get some of the benefit by using a DSL embedded inside a more general-purpose high-level language.
I've thought this for a while, almost ever since I learned Prolog. Make no mistake: I actually rather like Prolog. But I haven't been using it very much. The recent revelation is that C has all the same characteristics. And in a similar way, while I still like C to whatever extent, I'm going to avoid using it unless I really have to.
On a mostly unrelated note, I agree that Rust looks very promising. It's the new language that I'm the most excited about, especially after being let down by Go. Also, I'm not quite sure why he thinks the Rust syntax is odd: to me it seems extremely C-like, with some nice improvements (like implicit returns).
- bcoates 14y agoOut of curiosity, what are you hoping to get out of Rust that Go let you down on?
- tikhonj 14y agoThe best summary would be that I want a language to replace C++ but more sane and functional. Go is more like a language to replace Java and is most definitely not functional. Essentially, I don't see why I would ever use Go over Haskell or OCaml. The main areas where Haskell and OCaml are ill-suited are the lower-level ones currently dominated by C/C++ and Go does not seem to address those very well. The main areas Go is doing well, like server-side code, are very well suited to Haskell and OCaml and so I have no reason to drop down to a less declarative language like Go. Rust, on the other hand, seems to be targeting C++ directly. It also doesn't hate functional programming. So it perfectly fills the C/C++ shaped void in my current toolbox.
- dysoco 14y agoGo is a language for those who love the simple C/UNIX approach but would rather have a Garbage Collector there. I'd like Go to have manual memory management: But Google decided it was better this way. I don't really see it as a replacement for Java: But maybe for C (In non-critical performance software) or Python.
- jlgreco 14y agoGo is a language for young programmers who were perhaps brought up on Java or Python, but have discovered the "cat -v" mentality and are drawn toward it. Or alternatively, for old C programmers who are well versed in the 'cat -v' mentality who have tasted a bit of Java and Python but simply cannot buy into those.
- krmboya 14y agoCorrection. The "cat-v considered harmful" mentality.
- graue 14y agoTo most programmers, Go is less scary and foreign than Haskell/OCaml and thus easier to learn. Much as I love Haskell, I'll admit that's a pretty important advantage for Go if you need a team.
- wting 14y ago- optional gc - thread local gc vs Go's global gc - memory protection: Go has shareable mutable state - better functional programming support
- georgeorwell 14y agoI must say I find your comparison unusual! Whereas the rule-based declarative programming in Prolog is basically unheard of, C set the standard for all imperative languages to follow it. On top of that, a large number of languages either compile down to C or have a VM written in C, possibly C++. The typical language I hear lumped together in the same breath as Prolog is COBOL. Which is nevertheless widely used in production environments - something like 1 billion lines of code. Is anybody seriously using Prolog these days?