[OT] Dennis Ritchie's proposal for slices in C
Paulo Pinto
pjmlp at progtools.org
Mon Dec 9 10:22:19 UTC 2024
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][1] 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?
>
> [1]: https://digitalmars.com/articles/C-biggest-mistake.html
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
More information about the Digitalmars-d
mailing list