[Issue 14125] New: std.file has gotten out of hand

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Feb 4 14:58:43 PST 2015


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

          Issue ID: 14125
           Summary: std.file has gotten out of hand
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: andrei at erdani.com

std.file.read defines a few @trusted functions e.g. at
https://github.com/D-Programming-Language/phobos/blob/master/std/file.d#L259,
for each of the smallest unsafe operation performed in the actual function
itself. Far as I can tell those are for the purpose of making std.file.read
itself @safe.

The goal (making std.file.read @safe) is worthy and the approach, while fine in
letter, is awfully bad in spirit.

There is nothing to be gained by making each operation @trusted without due
verification; and when it comes to it it's easier to actually verify the body
of read() than building all that useless scaffolding.

To my horror there's a lot of similar misguided work in std.file. 

The right solution here is to make those functions @trusted.

The fact that such code got in - sometimes pulled by myself! - reveals a
problem with our review process. We need much better scrutiny and quality
control. And we need to sit down and undo the damage already done ASAP.

--


More information about the Digitalmars-d-bugs mailing list