News for hackers. Stuff that matters.
Re:Lisp and Smalltalk are dead: It’s C all the way down by ynniv on Sunday August 16, 2009 @03:20PM (#766524)
> I'm going to take two seconds and run strace on the program ... > I'm going to look at the manpage for open

Those are some silly arguments for teaching C. Someone with no understanding of C can just as easily read man pages. While it is useful to know C and assembly for debugging system calls via a debugger, this is rare compared to debugging via reading the documentation. Plenty of people wrote C based applications for the original Macintosh, even though the operating system was originally written in Pascal.

> I would challenge you to look around and find ANY stack of software that doesn't have C or C++ in it. It's just a matter of how deep you have to go to find it.

Thats a common, but baseless argument for knowing C. Most stacks are indeed written in C, but this is because most operating system interfaces are written in C, and C compilers are widely available and easy to write. Many efficient VM's have a minimal base written in C and transition to their own language early on. Amusingly, the Squeak VM from the original article is one of these.

> Are you saying we shouldn't equip them to understand things like trace compiling, which are the state of the art in language design and implementation?

Only students who specialize in compilers or virtual machines are going to dig that deep ... but what does that have to do with C?

> Sure, if all you want to do is web development, you can probably go a long ways without understanding system software. But you'll always be dependent on the people who understand the stack up and down.

That raises a good point - stop reading the web and get out there and till those fields, or you'll always be dependent on others for your basic needs. While you're out there, we'll debate the finer points of a specialized society.

I'll just point out that hardware and operating systems are useless without higher level applications. Those writing them are actually always dependent on others to make the combination do something useful.

Re:Lisp and Smalltalk are dead: It’s C all the way down by haberman on Sunday August 16, 2009 @04:17PM (#766637)
> Someone with no understanding of C can just as easily read man pages.

If all you know is Python, or Java, or another high level language, how would you even know that manpages that document system calls exist? How would you interpret the C function prototypes that are written there? How would you determine how high-level language constructs map to system calls? In my example, you got lucky because the open() function in Python calls the open() system call, but this is not universally true.

> Thats a common, but baseless argument for knowing C. Most stacks are indeed written in C, but this is because most operating system interfaces are written in C, and C compilers are widely available and easy to write.

So you acknowledge:

  - most software stacks are written in C
  - most operating system interfaces are written in C
  - C compilers are ubiquitous
...but also argue that we shouldn't teach students C? Are you arguing that it's not important for students to understand the system software that we both agree exists and is ubiquitous?

> That raises a good point - stop reading the web and get out there and till those fields, or you'll always be dependent on others for your basic needs.

Maybe you enjoy analogies, but I have direct experience in professional settings where I was able to use my knowledge of system-level software to solve problems that stumped people without this deep knowledge.

Maybe the most relevant example was at a web startup I worked at two years ago. Note that I was working on a website at the application level -- not writing system software. I had to solve several problems like this one:

http://dev.rubyonrails.org/ticket/8704

Solving this problem required repeatedly digging down into the Ruby interpreter, C extensions, system calls, signals, etc. Note that this was in my job as a webdev. Being able to solve problems like this made me stand out among my peers (who were also good developers, but didn't have as much systems experience as I did).

All I can hear you saying is that you don't think students should learn C because you personally don't like it. That's fine, but I am presenting evidence that it will make you a significantly better programmer. Don't tell aspiring programmers that knowing C won't help them, because it's simply not true.

Re:Lisp and Smalltalk are dead: It’s C all the way down by ynniv on Sunday August 16, 2009 @05:15PM (#766761)
I think that you've misinterpreted my original comment. My argument is that C is a poor language for teaching computing theory. There will be classes where students will learn C, certainly any hardware oriented class. The question at hand is, "Do students benefit from learning concepts in languages other than C", and I think that you'll agree the answer is "yes".
Re:Lisp and Smalltalk are dead: It’s C all the way down by haberman on Sunday August 16, 2009 @05:52PM (#766829)
Your initial claims were much broader than that ("I think that people talk about C as an important language because it is difficult to write programs in.", "Every year that goes by, C becomes less useful. How is this a good language to teach students?"), but let's go with your current claim.

Part of me sees the benefits of teaching computational complexity using a high-level language like Python. But part of me still can't buy into it, because what is the computational complexity of this excerpt of Python, in terms of n?

  strings = ["X"] * n
  concatenated = ""
  for s in strings:
    concatenated += s
The answer is that it depends on the implementation of Python!
Re:Lisp and Smalltalk are dead: It’s C all the way down by foldr on Sunday August 16, 2009 @05:54PM (#766831)
Well yeah, and the computational complexity of a program which calls a function in the C standard library depends on the implementation of C.
Re:Lisp and Smalltalk are dead: It’s C all the way down by haberman on Sunday August 16, 2009 @08:56PM (#767105)
You don't need the C standard library to write algorithms in C. Therefore you can do computational complexity analysis that is independent of the C language implementation.

(I don't actually think you could name a function from the ISO C standard library that differs in complexity across implementations, but it's besides the point).

Re:Lisp and Smalltalk are dead: It’s C all the way down by foldr on Sunday August 16, 2009 @11:11PM (#767260)
You don't need malloc, then? Please explain.
Re:Lisp and Smalltalk are dead: It’s C all the way down by haberman on Monday August 17, 2009 @03:44AM (#767571)
If you're analyzing complexity and your algorithm needs malloc(), then you implement and analyze malloc(). For example, see Knuth section 2.5.

By the way, do you have a point to make, or do you just enjoy being brusque?

Re:Lisp and Smalltalk are dead: It’s C all the way down by foldr on Monday August 17, 2009 @12:25PM (#768435)
I don't understand you here. If you write an algorithm in C that uses malloc, it will perform differently on different C implementations. This is exactly parallel to the fashion in which your python program will perform differently on different python implementations.