Reference semantic ranges and algorithms (and std.random)
Jonathan M Davis
jmdavisProg at gmx.com
Tue Sep 18 10:57:45 PDT 2012
On Tuesday, September 18, 2012 17:05:26 monarch_dodra wrote:
> This is issue #1: I'd propose that all objects in std.random be
> migrated to classes (or be made reference structs), sooner than
> later. This might break some code, so I do not know how this is
> usually done, but I think it is necessary. I do not, however,
> propose that they should all derive from a base class.
Moving to classes would definitely break code, but it should be possible to
make them reference types simply by making it so that their internal state is
in a separate object held by a pointer.
> The second issue I've run into (issue #2) is that even with
> reference semantics, there are still some issues regarding
> phobo's behavior with references ranges: Completly un-documented
> and inconsistent.
Reference-type ranges are not properly tested by Phobos in general, so they
just plain won't work in a number of cases. I've done some work in fixing that,
but there's plenty more to do. I really need to fiinish the unit test helper
stuff that I've been doing for ranges and get that into Phobos. It's almost
done, but I was running into weird build errors and haven't sorted them out
yet. Once that's done, it should be much easier to test a larger range of
range types (including reference types). Regardless, std.range and
std.algorithm in particular need to be properly tested for reference range
types and the related bugs fixed.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list