| ▲ | WalterBright 6 hours ago |
| > I’ve long been employing the length+data string struct. If there was one thing I could go back and time to change about the C language, it would be removal of the null-terminated string. It's not necessary to go back in time. I proposed a way to do it in modern C - no existing code would break: https://www.digitalmars.com/articles/C-biggest-mistake.html It's simple, and easy to implement. |
|
| ▲ | publicdebates 5 hours ago | parent | next [-] |
| > the fatal error was not combining the array dimension with the array pointer; all it needs is a little new syntax a[...]; this won’t fix any existing code. Over time, the syntax a[] can be deprecated by convention and by compilers. You're thinking in decades. C standard committee is slower than that. This could have worked in practice, but probably never will happen in practice. Maybe people should start considering a language like D[1] as an alternative, which seems to have the spirit of both C and Go, but with much more pragmatism than either. [1] https://en.wikipedia.org/wiki/D_(programming_language)#Criti... |
| |
| ▲ | pjmlp 2 minutes ago | parent | next [-] | | The C standard committee even refused Dennis Ritchie proposal for fat pointers. https://www.nokia.com/bell-labs/about/dennis-m-ritchie/varar... Meanwhile after UNIX was done at AT&T, the C language authors hardly cared for the C standard committee in regards to the C compiler supported features used in Plan 9 and Inferno, being only "mostly" compatible, followed up having a authoring role in Alef, Limbo and Go. > The language accepted by the compilers is the core ANSI C language with some modest extensions, a greatly simplified preprocessor, a smaller library that includes system calls and related facilities, and a completely different structure for include files. https://doc.cat-v.org/plan_9/4th_edition/papers/comp I doubt most C advocates ever reflect on this. | |
| ▲ | billforsternz 4 hours ago | parent | prev | next [-] | | There is some irony in someone replying to the author of the D language suggesting that maybe the D language is the real solution he's looking for. | | |
| ▲ | publicdebates 3 hours ago | parent | next [-] | | It might be the language he is looking for, but it might not, and more likely than not is not. D is one of those odd languages which most likely ought to have gotten a lot more popular than it did, but for one reason or another, never quite caught on. Perhaps one reason is because it lacks a sense of eccentricity and novelty that other languages in its weight class have. Or perhaps it's just too unfamiliar in all the wrong ways. Whatever the case may be, popularity is in fact one of the most useful metrics when ruling out a potential language for a new project. And if D does not meet GP's requirements in terms of longevity or commercial support, I would certainly not suggest GP adopt it too eagerly, simply because it happens to check off most or all their technological requirements. | | |
| ▲ | WalterBright 2 hours ago | parent | next [-] | | D is an elegant re-imagine of C and C++. For a trivial example, typedef struct S { int a; } S;
becomes simply: struct S { int a; }
and unlike C: extern int foo();
int bar() { return foo(); }
int foo() { return 6; }
you have: int bar() { return foo(); }
int foo() { return 6; }
For more complex things: #include <foo.h>
becomes: import foo;
| |
| ▲ | RickHull 3 hours ago | parent | prev | next [-] | | I think that D meets Walter Bright's requirements. | |
| ▲ | zxcvasd an hour ago | parent | prev [-] | | [dead] |
| |
| ▲ | I_am_uncreative 4 hours ago | parent | prev [-] | | A tale as old as time. |
| |
| ▲ | WalterBright 3 hours ago | parent | prev [-] | | The C committee is not afraid to add new syntax. And this is an easy addition. Not only does it deliver a massive safety improvement, it dramatically speeds up strlen, strcmp, strcpy, strcat, etc. And you can pick out a substring without needing to allocate/copy. It's easy money. |
|
|
| ▲ | cogwheel 4 hours ago | parent | prev [-] |
| https://web.archive.org/web/20260116161616/https://www.digit... for anyone here while we're swamping Walter's site |
| |