Live data from Hacker News

C, The Beautiful Language

tenaciousc.com

71–80 of 85 posts

Re: C, The Beautiful Language

#71
post #65
post #61

Earlier quoted context omitted.

Only in early Lisps (and the broken newLisp) are functions lists. The syntax for functions is lists. But at runtime functions are their own type.

Pardon? [1] Are you sure? [2] How about no? [3] Perhaps you prefer Vim over Emacs? [4] --- [1] http://en.wikipedia.org/wiki/Picolisp my favorite [2] http://en.wikipedia.org/wiki/Scheme_(programming_language) probably the best known [3] http://en.wikipedia.org/wiki/Arc_(programming_language) this bloody website runs on it [4] http://en.wikipedia.org/wiki/Emacs_Lisp the good, the bad and the ugly, all in one package

In Scheme try and compare

   (car (list 1 2 3 4))
with

   (car (lambda (x) x))
But I guess we are talking about different levels of abstraction?

Re: C, The Beautiful Language

#72
post #59
post #56

Earlier quoted context omitted.

int *var1, var2; is not clear at all. var1 has type "int pointer", and for each type T, its pointer type is represented as the type T*. It's just one of the many ways the C user interface is broken beyond reason. The point is not that you can't do good things in C. The point is that it is very easy to do bad things in C. A good UI makes good things the natural way to do things, and actively discourages bad things. C'…

It's just one of the many ways the C user interface is broken beyond reason. I'd say this one is just a question of preference. I happen to like to be able to declare my variables together with my ponters. A good UI makes good things the natural way to do things, and actively discourages bad things. C's UI is the opposite. In my opinion, that's the beauty of C: unlike Java (and, to a little extent, C++) it doesn't di…

The small cost of not being able to declare your variables together with your pointers is nothing compared to the confusion it avoids.

    int* var1;
is the way I (and I suspect anyone who's studied theoretical algebraic data types) think about my variables and types. It sucks that C forces me to mentally translate it to a much less satisfying form.

I'm not sure what being ridiculously easy to make errors in has to do with dictating how to write your programs.

Re: C, The Beautiful Language

#73
post #71
post #65

Earlier quoted context omitted.

Pardon? [1] Are you sure? [2] How about no? [3] Perhaps you prefer Vim over Emacs? [4] --- [1] http://en.wikipedia.org/wiki/Picolisp my favorite [2] http://en.wikipedia.org/wiki/Scheme_(programming_language) probably the best known [3] http://en.wikipedia.org/wiki/Arc_(programming_language) this bloody website runs on it [4] http://en.wikipedia.org/wiki/Emacs_Lisp the good, the bad and the ugly, all in one package

In Scheme try and compare (car (list 1 2 3 4)) with (car (lambda (x) x)) But I guess we are talking about different levels of abstraction?

Indeed, you are right about Scheme (and Arc). Thanks for the correction.

Re: C, The Beautiful Language

#74
post #71
post #65

Earlier quoted context omitted.

Pardon? [1] Are you sure? [2] How about no? [3] Perhaps you prefer Vim over Emacs? [4] --- [1] http://en.wikipedia.org/wiki/Picolisp my favorite [2] http://en.wikipedia.org/wiki/Scheme_(programming_language) probably the best known [3] http://en.wikipedia.org/wiki/Arc_(programming_language) this bloody website runs on it [4] http://en.wikipedia.org/wiki/Emacs_Lisp the good, the bad and the ugly, all in one package

In Scheme try and compare (car (list 1 2 3 4)) with (car (lambda (x) x)) But I guess we are talking about different levels of abstraction?

Not that this has too much to do with what you two were talking about, but (car '(lambda (x) x)) will return lambda in Scheme.

Re: C, The Beautiful Language

#75

Earlier quoted context omitted.

What are some specific examples of beautiful C code in your view? Asking for a friend.

The Busybox project.

I'm glad. Somewhere on my mental "code I'd like to read list" is the busybox code, because I don't understand how it does so much with so little. If it does it and looks good, I'm doubly impressed. :)

Re: C, The Beautiful Language

#76
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?

What about Ada?

Re: C, The Beautiful Language

#77
post #74
post #71

Earlier quoted context omitted.

In Scheme try and compare (car (list 1 2 3 4)) with (car (lambda (x) x)) But I guess we are talking about different levels of abstraction?

Not that this has too much to do with what you two were talking about, but (car '(lambda (x) x)) will return lambda in Scheme.

You are right.

Actually I was almost going to add (car '(lambda (x) x)) to my post in the first place; in line with `The syntax for functions is lists.'

Re: C, The Beautiful Language

#78
post #73
post #71

Earlier quoted context omitted.

In Scheme try and compare (car (list 1 2 3 4)) with (car (lambda (x) x)) But I guess we are talking about different levels of abstraction?

Indeed, you are right about Scheme (and Arc). Thanks for the correction.

Sure, no problem. I guess Emacs Lisp falls under the old-and-broken category. And Picolisp eschews functions as a data-type by choice. Do you know whether Picolisp offers lexical scoping?

Re: C, The Beautiful Language

#79
post #78
post #73

Earlier quoted context omitted.

Indeed, you are right about Scheme (and Arc). Thanks for the correction.

Sure, no problem. I guess Emacs Lisp falls under the old-and-broken category. And Picolisp eschews functions as a data-type by choice. Do you know whether Picolisp offers lexical scoping?

It offers something similar-but-not-quite called transient symbols: http://www.software-lab.de/doc/faq.html#problems

Alternative phrases for similar-but-not-quite: insidious, error-prone.

Re: C, The Beautiful Language

#80
post #53
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…

C is the language some may love to hate, but an experienced developer will create clean, concise code. I remember reading through cifsd [1] by cinap_lenrek and thinking, ``my god, this is beautiful''. No boilerplate, just straightforward code. And yes, unobtrusive error handling. Also, a blogpost post comes to my mind: ``A Timeless, Desert Island Language'': `And that's why I'd choose C as my desert island language.…

>... I can bootstrap a basic Lisp interpreter

That sounds like an argument for any language, though. As long as you can build the language of your choice in language X, you're fine being stuck with X because you're not really stuck.

If they had to write absolutely everything in more "pure" C, would their tune be the same? I think C is a fine language, but it's missing some significant niceties. Like a decent native string class.

Post reply on HN