Generally, dynamic arrays / slices are random-access ranges. Narrow strings (string/wstring/char[]/wchar[]/...) are a notable exception to this. They are dynamic arrays of UTF-8/UTF-16 code units. But they're not random-access ranges of Unicode code units. Instead, they're _forward_ ranges of Unicode code _points_ (dchar). They have special range primitives that to the decoding.
So slices are random-access ranges... I understand the random-access part... but are they inheriting from Range, do they just include a Range? Why is int[] an array when I declare, but variable[] a Range?? Or isn't it a Range?

A range is just any type that satisfies certain properties (e.g. has front, empty, popFront in the most basic case). int[] is a range because front, empty and popFront are defined for it in std.range, which can be called with "uniform function call syntax" (UFCS) as if they were members of the type int[] itself.

Reply via email to