News for hackers. Stuff that matters.
Re:How can C Programs be so Reliable? (2008) by sillysaurus2 on Thursday December 05, 2013 @03:46PM (#6857096)
Tarsnap is the classic example of a C program whose reliability almost defies belief. Its codebase is large; it solves a very hard problem; and it manages to handle almost every cornercase flawlessly. (As of the latest version, it seems to handle every cornercase flawlessly, as far as I know.)

But I've always wondered: if Colin were as experienced with Python as he is with C, would Tarsnap be better served by writing it in Python? It seems like the codebase would be half as large.

In other words, is C the reason why Tarsnap is good, or is it because of Colin? Or is it both?

Example: Lisp, along with PG, is the reason why HN is good. Many of HN's features simply wouldn't be easily accomplished without it, so they wouldn't ever have been implemented. But I'm not sure the same could be said of Tarsnap.

But let's be honest - in how many languages can one retrospectively add a garbage collector?

Many. Lisp in particular. HN's links like /x?fnid=KxPuWC6qnkl4nxcUTDh4xs are an example of this.

Re:How can C Programs be so Reliable? (2008) by RyanZAG on Thursday December 05, 2013 @03:55PM (#6857151)
It's rarely the language that has any actual effect on the end result. The language is just a side show - the main story is about how well the developer understood the problem space and how well the abstractions and solutions he generated work to solve the problem.

Language can help a bit in making it clearer and giving the programmer more time to work on the important parts - but this actually goes both ways. Not having to worry about memory is a definite plus, but it can also be a big minus when you need to do something specific with that memory. For example, mutating in place is very easy in C when its required, but trying to mutate in place in some of the newer languages is very difficult.

Also it's doubtful if Tarsnap would be better if it was in Python. It might (or might not, depending on optimizations) have been quicker to write it originally in Python - but nobody would trade an already created C tarsnap for a Python tarsnap because the Python one would use more ram and run slower.

Re:How can C Programs be so Reliable? (2008) by rbanffy on Thursday December 05, 2013 @09:39PM (#6859040)
> It's rarely the language that has any actual effect on the end result.

Implementing HN in APL is left as an exercise for the reader.

Re:How can C Programs be so Reliable? (2008) by byroot on Thursday December 05, 2013 @07:25PM (#6858441)
> the reason why HN is good

I don't get this.

I would chose reddit over HN any given day technically / ergonomically speaking.

Actually if https://news.ycombinator.com was returning a 301 to https://reddit.com/r/hackernews I would be very happy.

Re:How can C Programs be so Reliable? (2008) by qznc on Friday December 06, 2013 @07:59AM (#6860836)
Is /r/hackernews officially restricted by Reddit or what is going on there?
Re:How can C Programs be so Reliable? (2008) by mikeash on Thursday December 05, 2013 @03:54PM (#6857144)
Wait, HN is good? The community is interesting, but I've never been particularly impressed by the implementation. In particular, the "feature" where "More" links and such randomly expire after a while just screams "shoddy implementation" to me.
Re:How can C Programs be so Reliable? (2008) by AceJohnny2 on Thursday December 05, 2013 @04:29PM (#6857397)
The thing is, the "more" links are specific to each user and generated page. They're not just "page 3 at the time you click on the link", but the actual next 30 links following the 30 it's previously shown you. As a result, it needs to store state for each of these links it's created (IIRC, the fnid is a reference to the closure containing that state). For obvious memory management purposes, these need to be expired after some time.

I agree that it's an odd implementation choice though. I guess it made sense when HN was smaller and it could grant more ressources to each user. Nowadays, Reddit's simpler system (with risks of duplicates or missing rising links as you go deeper) would probably make more sense.

Re:How can C Programs be so Reliable? (2008) by mikeash on Thursday December 05, 2013 @04:49PM (#6857522)
I understand that it's a tough problem and can totally understand solving it by just making the links quit working like that. But that sort of thing doesn't strike me as "good", even if it is highly pragmatic.
Re:How can C Programs be so Reliable? (2008) by pkolaczk on Friday December 06, 2013 @07:30AM (#6860750)
And why not store that state on the client? 30 serialized ids is not that much.
Re:How can C Programs be so Reliable? (2008) by aryastark on Thursday December 05, 2013 @04:29PM (#6857399)
Yeah, I really can't believe that hasn't been fixed by now.

Not only that, but it's impossible to follow discussions here. You have to go through your comment history to find threads you reply to.

Re:How can C Programs be so Reliable? (2008) by elwell on Thursday December 05, 2013 @05:12PM (#6857699)
The UI is in some way (i think) intentionally poor. For example, when you want to reply to a comment it takes you to a new page, and then you still have to click on the textarea to focus it. I think they don't want people to be able to comment quickly.
Re:How can C Programs be so Reliable? (2008) by nilkn on Thursday December 05, 2013 @03:52PM (#6857138)
> E.g. Lisp, along with PG, is the reason why HN is good. Many of HN's features simply wouldn't be easily accomplished without it

Could you expand/elaborate on this? I've never viewed HN as particularly complex, just tastefully designed with a good community.

Re:How can C Programs be so Reliable? (2008) by recuter on Thursday December 05, 2013 @04:16PM (#6857297)
I never read the Arc source but I bet what he means is how comments are laid out in memory which you can see is reflected with direct links:

https://news.ycombinator.com/item?id=6857138

I'm not sure why that would be impossible in a none-lisp, just less elegant.

Re:How can C Programs be so Reliable? (2008) by zurn on Thursday December 05, 2013 @04:59PM (#6857609)
The traditional argument for high level languages is that you can try many more things in the same time, and that you can focus more of your cognitive faculties on the business problem at hand.

But C guides you to simplify, and gives you control. Combined with the right certain amount of taste this can lead to exceptionally good outcomes. See also qmail, plan 9, etc.

Re:How can C Programs be so Reliable? (2008) by stinkypete on Thursday December 05, 2013 @03:52PM (#6857136)
/x?fnid=KxPuWC6qnkl4nxcUTDh4xs resolves to "unknown or expired link". Do you have a full URL?
Re:How can C Programs be so Reliable? (2008) by zb on Thursday December 05, 2013 @03:56PM (#6857156)
It got garbage-collected. That's the point.
Re:How can C Programs be so Reliable? (2008) by stinkypete on Thursday December 05, 2013 @04:04PM (#6857219)
Gotcha. The parent comment made it seem like that was a link to information about retrospectively adding GC to other languages, especially given that Lisp already has GC as nearly an assumption at the language level. But I can see what he was trying to get at.
Re:How can C Programs be so Reliable? (2008) by elwell on Thursday December 05, 2013 @05:10PM (#6857688)
haha, exactly