Hacker News new | past | comments | ask | show | jobs | submit login

>C’ syntax is robust so add these missing gaps to the current language and weall win.

If every feature everyone wanted was added to C, it would just turn into a bloated mess like C++, or like PHP, with tons of bad decisions baked into the language that can't really be avoided. Features like this belong in libraries - the stdlib should remain as minimalistic as possible.




If everything everyone wanted was added to C, it would be C++. :-)

The C++ evolution is essentially an iterative cycle where people hackily create new language features with insane preprocessor and template hackery, and then the Standards Committee comes in and takes the most popular hacks and tries to turn them into real language features. And then people create new hacks on top of that.

C says, you want object oriented polymorphism, you've got structs and function pointers, what more do you need?


>C says, you want object oriented polymorphism, you've got structs and function pointers, what more do you need?

No, C says your first mistake was wanting object oriented polymorphism. Your second mistake will be implementing it.


This is of course implicit in the mindsets -- C++ is continually trying to support new idioms for the programmer to express themselves, C would prefer you stick as close as possible to a smaller set of idioms. Just because you can technically make use of a design pattern in C, doesn't mean the language (or the community) will ever encourage that.


Most large C projects end up succumbing to something like this at some point.


I participated in the coding of several arcade games in Z80 assembler in the late 80s. Not "a" large project but a collection of small ones.

These programs, by the time I came aboard and started sharing code with those to make the games I was involved in, had also "succumbed" to this force.

The shared bedrock of all these games was code that used certain Z80 registers as pointers to take advantage of instructions that read or wrote fixed offsets from those pointers. The first byte of the record pointed at by the pointer was the type and the next 4 bytes were the position. The rest of the record depended on the type.

That was us doing the best we could with 8-bit processors when our competition was using 68000.


Many C projects indeed have polymorphism (I believe io libraries do exactly that to implement the idea that "everything is a file"), but this is rather different from object-oriented polymorphism.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: