[Issue 14125] std.file has gotten out of hand
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Feb 4 17:03:34 PST 2015
https://issues.dlang.org/show_bug.cgi?id=14125
--- Comment #21 from Andrei Alexandrescu <andrei at erdani.com> ---
(In reply to hsteoh from comment #20)
> It seems that there's a disconnect here between @trusted as marking a
> trusted *interface* (i.e., behind the interface is code that's potentially
> dangerous, but you cannot trigger the dangerous behaviour using that
> interface), and @trusted as marking a potentially dangerous *operation* that
> is actually safe because the surrounding context ensures that it is never
> used in an unsafe way.
Well put. If I have a free-for-all trusted address taking at the top of a
function:
https://github.com/D-Programming-Language/phobos/blob/master/std/file.d#L198
then what good does that do to anybody?
> The former is for presenting an interface to the user that we can verify
> won't trigger unsafe behaviour; the latter is for preventing accidental
> breakage of the trusted code by careless change. What Walter said pertains
> to the former; what Dicebot said pertains to the latter.
>
> Neither are directly related to syntax, though, which is apparently what
> provoked this backlash. If it's the syntax that's the problem, then we
> should be looking at dedicated syntax for @trusted blocks inside functions,
> or always inlining lambdas that are immediately invoked.
Syntax is the least of the problems here.
> Putting std.file on
> the pedestal as the whipping boy isn't actually solving the core issues IMO.
I see fixing std.file as an important and urgent matter. Phobos code is how
industrial-strength code should be written, and should stand as an example of
idiomatic use of D. Right now std.file is anything but a good example to
follow.
--
More information about the Digitalmars-d-bugs
mailing list