Live data from Hacker News

C, The Beautiful Language

tenaciousc.com

41–50 of 85 posts

Re: C, The Beautiful Language

#41
post #5
post #2

C is more a description of a Harvard machine than a von Neumann machine. In fact, a useful new language feature would be dynamic generation of machine code.

Of course this isn't a feature of the language -- but most implementations (e.g. gcc) technically allow this, if you really, really know what you're doing. For example: http://www.cesarbs.org/blog/2010/07/19/run-time-machine-code...

Writing code that writes code, where that written code is executable at machine speeds rather than interpreted, is a qualitative difference over a simple "eval" implementation; and it can most definitely be a feature of the language.

A language which supports it as a feature may do things like partial evaluation of closures, inlining of runtime-constructed code, transforming e.g. the typical block-passing idiom of a Ruby into specific optimized cases. Being able to rely on such transformations in turn lets you build more abstract (i.e. more highly parameterized) libraries because you know you won't have to pay the same degree of abstraction tax.

Re: C, The Beautiful Language

#42
post #22

All it means is that he understands C better than other languages. Even Java (yes, Java) has these rhythms that he speaks of. You look at code and you feel the logic, even the necessity of it. That's just the feeling of being in tune with code and with the person who created it, thanks to a shared understanding of the language. Master any language and you'll get the same feeling when you read well-written code. Actua…

Exactly, and C is the worst offender for boilerplate code. There isn't even a list abstraction! It's surprising that there's an array abstraction and that people aren't just forced to use pointer arithmetic.

Re: C, The Beautiful Language

#43
post #8

In my experience it is more 'fun' to write C code then to lay down yet another line of boiler-plate high level code. However, it seems to take longer to get things done and the resulting code is also much more error-prone (at least my code that is).

> boiler-plate high level code

If it were truly high-level, this would be an oxymoron.

Re: C, The Beautiful Language

#44

Stupid question: what do you do when you're working in C and want OOP?

http://www.bolthole.com/OO-C-programming.html

That's a simple intro to doing OO in C, mainly by becoming a human compiler that goes from whatever OO language you really want to C.

Note well that OO isn't a well-defined concept. Look at this list of features and ask yourself which of them you think of as being OO:

http://www.paulgraham.com/reesoo.html

Re: C, The Beautiful Language

#45
post #39

This sort of idiocy is what holds computer science back. C, because of how close to the metal it is, is pretty much the ugliest language in wide use, and the fact that we know a lot more about programming languages and user interfaces now than when C was designed doesn't help. It should only be used as a last resort, when you really need the speed, and even then one should keep an eye out for alternatives.

Which language would you suggest as replacement for writing of sched.c and page_alloc.c?

Re: C, The Beautiful Language

#46
It was a cute sales pitch for the company's C IDE. I especially like how they use "soccer", a word that resembles "sorcery". Talking about how one (only?) gets the gist of things and is not a kernel hacker was great to speak to the less-than-competent. Yes yes few of us write kernel modules but still. Encouraging coders to be comfortable with C when they sell a product to help, brilliant!

Re: C, The Beautiful Language

#47
post #45
post #39

This sort of idiocy is what holds computer science back. C, because of how close to the metal it is, is pretty much the ugliest language in wide use, and the fact that we know a lot more about programming languages and user interfaces now than when C was designed doesn't help. It should only be used as a last resort, when you really need the speed, and even then one should keep an eye out for alternatives.

Which language would you suggest as replacement for writing of sched.c and page_alloc.c?

Oberon or Modula-2 maybe?

Re: C, The Beautiful Language

#48
post #45
post #39

This sort of idiocy is what holds computer science back. C, because of how close to the metal it is, is pretty much the ugliest language in wide use, and the fact that we know a lot more about programming languages and user interfaces now than when C was designed doesn't help. It should only be used as a last resort, when you really need the speed, and even then one should keep an eye out for alternatives.

Which language would you suggest as replacement for writing of sched.c and page_alloc.c?

Last resort, remember. I'm not saying C doesn't have its place -- I'm saying that it should be used as little as possible. While I guess there's no other option for a memory allocator, it should be quite possible to write a scheduler in another, better systems language like Rust.

edit: actually, possibly not -- Rust might be a little too abstract. My point still stands, though.

Re: C, The Beautiful Language

#49
post #22

All it means is that he understands C better than other languages. Even Java (yes, Java) has these rhythms that he speaks of. You look at code and you feel the logic, even the necessity of it. That's just the feeling of being in tune with code and with the person who created it, thanks to a shared understanding of the language. Master any language and you'll get the same feeling when you read well-written code. Actua…

+1 C is ugly.

- Why do I need to typedef a struct to make it look like any other type?

- Why do function pointers look so bad?

- Error handling in C? Those goto exception; if(0){exception:} sure look fantastic.

- int* var1, var2; var2 is an int, not an int* ... The language lets you stick the * right next to the type as though it modifies the type. Which it does in casts. (how do I escape asterisks on here?)

- A system language where int can be 32 bits or more.

And probably more from people more experienced in C than me.

Re: C, The Beautiful Language

#50
post #6

> we watch Ronaldo doing things on the pitch Hmmm... Lionel Messi does crazy things you never thought were possible. He's Lisp. Gareth Bale has few fancy tricks, but does what he does very well, and often relies on pure speed - C. Joey Barton is good, but has a bad reputation and a sordid history - Fortran? Etc :-)

You know your soccer my friend ... but you left out Java. I'd say that's like Miroslav Klose ... big, strong, not particularly fast or lovely to watch but damned good at putting away goals when it matters. surprisingly so.

I like that about Klose :-)

I disagree about Barton - which language consistently repeats past mistakes and is liable to stab you in the eye?

Post reply on HN