[TUHS] History of popularity of C

Bram Wyllie bramwyllie at gmail.com
Mon Jun 8 10:24:38 AEST 2020


Dependent types aren't needed for sum types though, which is what you'd
normally use for an array that carries its size, correct?

On Sun, Jun 7, 2020 at 7:57 PM Chris Torek <torek at torek.net> wrote:

> >Safe Rust code is data race free, but not free of race
> >conditions, let alone thread safe in all ways.
>
> Er, yes.  I mainly wanted to contrast to Go, where you look for
> race conditions by building with a flag that enables runtime
> checking.  This can only detect races that actually occur,
> and if there are paths that would still have races that didn't
> occur on your test run, well...
>
> >>[rust array limitations]
>
> >I'm afraid this is incorrect.  Rust arrays are indexed by a
> >`usize`, which is basically whatever `size_t` would be in C. Rust
> >arrays in general can be essentially arbitrarily large (up to
> >limitations imposed by the target machine, of course).
>
> >However, Rust does not support dependent types, most certainly
> >not for arrays.  In other words, an array's size is considered
> >part of its type and so when specializing traits on arrays, one
> >must do so explicitly for each supported array size.  For
> >practical reasons such implementations are often limited to a
> >relatively small number of distinct sizes; 32 is a believable
> >number.  Perhaps that's what you're thinking of?
>
> Ah, yes, that was it.  (As I said, I never really had time to
> do anything "real" in Rust.)
>
> Go's slices are nice to use, but slices (and maps, for that matter)
> trip people up because they are headers that point to shared
> spaces.
>
> Chris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20200607/9f8592a5/attachment.htm>


More information about the TUHS mailing list