DMD supports ranges, but druntime can't see them?

Manu turkeyman at gmail.com
Thu May 23 07:17:19 UTC 2019


On Wed, May 22, 2019 at 11:45 PM Mike Franklin via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Thursday, 23 May 2019 at 06:16:08 UTC, Manu wrote:
> > I noticed a bizarre situation just now; while DMD has magic in
> > the compiler to understand ranges and lower foreach loops to
> > call range primitives and such, the material to determine any
> > range API is not available to druntime, it's all the way out in
> > std.range.primitives.
> >
> > Why is there no core.range with said primitives in it? I think
> > it's fine that chain and zip and iota all that jazz is in
> > phobos, but surely isInputRange, isRandomAccessRange,
> > hasLength, etc should all be in the lowest level runtime
> > possible?
>
> I think Andrei said it best here:
> https://forum.dlang.org/post/q7j4sl$17pe$1@digitalmars.com

Right... but we're a decade away from that vision, we should do
something for the time being.


> > It's kinda the same deal as those select traits which are
> > practically part of the language, they don't generate any code,
> > and it's virtually impossible to do anything useful without
> > them.
> >
> > Should they be moved?
>
> For now, yeah, perhaps they should just be moved to `core.range`
> or something like that until a better vision of what a united,
> pay-as-you-go druntime/phobos is worked out.
>
> I'm mentoring a GSoC project this year and we could actually
> benefit from having some of that range stuff in druntime.
>
> And this isn't unique to the range stuff.  There's quite a bit in
> Phobos (std.traits, std.conv, std.meta, etc...) that really needs
> to be available to all D programs including druntime and the
> compiler itself.

Indeed. Although only subsets of each of those files for my money, and
they feel improperly organised to me.

So, std.range.primitives -> core.range ?


More information about the Digitalmars-d mailing list