[Issue 14810] std.mmfile should only return a shared!T object

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 20 17:29:27 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14810

Jonathan M Davis <issues.dlang at jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dlang at jmdavisProg.co
                   |                            |m

--- Comment #1 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
Last time I was looking at this, I came to the conclusion that if we wanted
std.mmfile.MmFile to be @safe, what really needed to happen was that rather
than returning an array from opSlice, it would need to return a
reference-counted object that ensured that the memory wasn't unmapped until
there were no more references to it floating around. And there's a decent
chance that MmFile should have been a struct rather than a class (which seems
to be what you're arguing for, but you talk about std.mmfile returning stuff,
which doesn't make sense, since it's a module), but I'd have to look at it
again to decide what my take on that would be at this point.

Regardless, std.mmfile could use some redesign. It's looks like it comes from
D1 originally, so it predates ranges and @safe and all of that kind of fun
stuff. So, while it's useful, it isn't really designed in the way that we'd
design it now.

--


More information about the Digitalmars-d-bugs mailing list