Earlier quoted context omitted.
It’s mostly semantically very poor to be honest. C really is a nicer assembly in a lot of way. It’s extremely limited. You have branching logic, functions call, pointer arithmetic, a way to define data structures which are really memory layouts and that’s pretty much it. I guess you can appreciate that as an aesthetic statement but what you wrote would apply equally to any language with more complex semantics.
C would be a better language if it really lived up to its old ideal of being a "portable assembly language". That stopped being true as compilers started optimizing undefined behavior (e.g. signed overflow). Instead of a "+" in the source code yielding an honest-to-goodness hardware add instruction, it could be "optimized"--i.e. constant folded, CSE'd, strength-reduced, value-range-analyzed, among others--by an optim…
50 years of C, the good, the bad and the ugly [video]
111–120 of 257 posts
Re: 50 years of C, the good, the bad and the ugly [video]
#112His final conclusion is that C has to go, just like COBOL, Fortran, and PL/I. I wonder how long it will take before C will be gone totally when you realize how much COBOL and Fortran are still around. Not so long ago, I came along a module for Python 'SciPy.interpolate' that happens to be programmed in Fortran.
C is the best abstraction for many problem domains and that isn't going to change. I understand why folks coming from higher-level languages would dislike it, but for anyone coming from assembly it's a godsend. The speaker discourages C for new projects, but that says more about the problem domains they work in than C itself. C is what it is because the hardware and assembly language are what they are. Folks who want…
Would that be LLVM's IR or MLIR (https://mlir.llvm.org)?
Re: 50 years of C, the good, the bad and the ugly [video]
#113Earlier quoted context omitted.
Art is often about constraint, and mastery of simple tools. I identify with @antirez's sentiment. I know both C and C++ very well. I find C definitely more artistic. C++ is utilitarian. Prolog is the other language I code in "artistically". It too is quite simple and constrained, though it is on the opposite end of the high/low-level spectrum as C.
What is your take on Perl and Ruby? They seem to be the two languages where the communities themselves talk the most about poetry and elegance.
/unpopular-hot-take
Re: 50 years of C, the good, the bad and the ugly [video]
#114His final conclusion is that C has to go, just like COBOL, Fortran, and PL/I. I wonder how long it will take before C will be gone totally when you realize how much COBOL and Fortran are still around. Not so long ago, I came along a module for Python 'SciPy.interpolate' that happens to be programmed in Fortran.
Can C really completely go away as long as there's embedded programming? Are there any other alternatives for that domain?
Unfortunately Ada is held back by a genuine lack of awareness and some old misinformation baggage.
Re: 50 years of C, the good, the bad and the ugly [video]
#115Earlier quoted context omitted.
Without it, you cannot express arithmetic wrappers or simd wrappers. So far, no language with any users has managed to provide adequate arithmetic and simd types built in, despite several attempts like Odin and CosmiC/HolyC. I'm not sure it's even possible to design such types that satisfy everyone, and they must be extensible somehow because satisfying anyone is a moving target. Note how terrible doing any amount of…
Also without operator overloading, it wouldn't be possible to implement lazy evaluation, which along with the use of expression templates happens to be one of the most crucial aspects that any linear algebra library will want to take advantage of in order to generate the most optimal code.
I don’t understand that. You can have functions that return promises that then can get passed to other functions returning promises, and leave it either to the compiler or to an expression evaluator you write (that ideally runs at compilation time as much as possible) to optimize away anything not needed. For example (pseudo-code)
vector3D a = …
vector3D b = …
promise c = addLazily(a,b)
print c.x
in the end, could do the equivalent of print a.x + b.x
I think you could make a modern C++ compiler do that for this simple example.Re: 50 years of C, the good, the bad and the ugly [video]
#116Earlier quoted context omitted.
It’s mostly semantically very poor to be honest. C really is a nicer assembly in a lot of way. It’s extremely limited. You have branching logic, functions call, pointer arithmetic, a way to define data structures which are really memory layouts and that’s pretty much it. I guess you can appreciate that as an aesthetic statement but what you wrote would apply equally to any language with more complex semantics.
> that’s pretty much it. Only if you ignore 1. variadic arguments as in printf, 2. function pointers which are a very elementary (type-unsafe) form of closures, 3. a nice way of casting to void 4. setjmp and longjmp goodies (?) which allow you to code up co-routine libraries and exception handling mechanisms I'm sure there are more such facets I am missing. The elegance of the specification may be questionable, but t…
Re: 50 years of C, the good, the bad and the ugly [video]
#117Earlier quoted context omitted.
C would be a better language if it really lived up to its old ideal of being a "portable assembly language". That stopped being true as compilers started optimizing undefined behavior (e.g. signed overflow). Instead of a "+" in the source code yielding an honest-to-goodness hardware add instruction, it could be "optimized"--i.e. constant folded, CSE'd, strength-reduced, value-range-analyzed, among others--by an optim…
In the absence of CPU instruction which does the saturated ADD, how do you solve the overflow problem in a bare-metal language without introducing the performance hit?
Re: 50 years of C, the good, the bad and the ugly [video]
#118Earlier quoted context omitted.
I think it will go when we have a sufficiently popular and useful systems programming language that will replace it. It has to be a language that isn't just C with some extra bits, which is why SafeC and CheckedC aren't more popular. I actually think the closest language will be Zig. It's a much simpler language than Rust and people who like C really value that simplicity. It also removes a lot of Cs baggage that mak…
SafeC and CheckedC do nothing for temporal safety. Zig is in the same boat. There's not really a simpler alternative to Rust with the same featureset, even its direct predecessor Cyclone was in fact quite a bit harder to use. Rust itself is also improving very quickly and becoming easier to use over time.
Re: 50 years of C, the good, the bad and the ugly [video]
#119Earlier quoted context omitted.
This shouldn't be downvoted. C++ is a superset of C; it must be capable of being at least as "brutal and honest" and "abstract and deceiving" as C. I would argue that C++ can be dramatically more deceiving than C --- see inheritance and operator overloading, just to name two.
Operator overloading is the one thing that makes C++ strictly better than any language that does not allow it.
If you can just extend the types then you can provide operators that way and there's less opportunity for ambiguity. See Rust.
Also so many of the C++ operator overloads are broken instead of just not existing, which tempts you to overload things instead of saying "Nope, that's a bad idea" and just walking away altogether.
Example, boolean short-circuiting AND and OR. If we write
if (this() || that()) foo();
in C++ then that OR is short-circuiting, so that() won't get called if this() is true.But if the return type used overloads the boolean OR operator, short-circuiting is disabled, and now both this() and that() are always called...
Re: 50 years of C, the good, the bad and the ugly [video]
#120Earlier quoted context omitted.
What is your take on Perl and Ruby? They seem to be the two languages where the communities themselves talk the most about poetry and elegance.
Perl and Ruby are very expressive. Python on the other hand feels like a scripting language designed by a 1990s corporate Java developer. /unpopular-hot-take