Thread overview
[OT] Dennis Ritchie's proposal for slices in C
11 hours ago
Paul Backus
11 hours ago
Walter Bright
23 minutes ago
Paulo Pinto
11 hours ago

As it turns out, even the original creator of C recognized its biggest mistake all the way back in 1990, and came up with a plan to address it. Here's the link to the paper:

https://www.bell-labs.com/usr/dmr/www/vararray.pdf

The syntax is a little weird--he uses

int (*arr)[?];

...instead of Walter's proposed

int arr[..];

...but the core idea is the same: "the pointers carry the array bounds inside themselves." That is, instead of a naked pointer, arr stores a pointer+length pair.

It's honestly kind of incredible that the C committee has been sitting on this for more than 30 years. What the heck were they thinking?

11 hours ago
On 12/8/2024 2:48 PM, Paul Backus wrote:
> It's honestly kind of incredible that the C committee has been sitting on this for more than 30 years. What the heck were they thinking?

It is amazing indeed, considering all the useless complexity they've added to C, like normalized Unicode identifiers.

Of course, C++ refuses to fix it as well.

23 minutes ago

On Sunday, 8 December 2024 at 22:48:17 UTC, Paul Backus wrote:

>

As it turns out, even the original creator of C recognized its biggest mistake all the way back in 1990, and came up with a plan to address it. Here's the link to the paper:

https://www.bell-labs.com/usr/dmr/www/vararray.pdf

The syntax is a little weird--he uses

int (*arr)[?];

...instead of Walter's proposed

int arr[..];

...but the core idea is the same: "the pointers carry the array bounds inside themselves." That is, instead of a naked pointer, arr stores a pointer+length pair.

It's honestly kind of incredible that the C committee has been sitting on this for more than 30 years. What the heck were they thinking?

Yes, and this kind of makes the point WG14 has no interest fixing the issue, when not even one of the language authors can change their mind.

Note that the languages they designed afterwards, Alef, Limbo and Go, don't have this issue.

Also AT&T did had a go at other less well known languages like C+@ (yeah horrible idea as name, see [0]), and Cyclone (whose ideas ended up being known in mainstream via Rust).

[0] - https://encyclopedia2.thefreedictionary.com/C%2B%40