DIP1028 and phobos
Uknown
sireeshkodali1 at gmail.com
Sat May 23 05:16:39 UTC 2020
With DIP 1028 finally being accepted, we now have @safe by
default. If we ignore the extern function controversies around
the DIP for a second, its worth looking at some of the other
issues that DIP 1028 brings.
Consider the following trivial code:
void main(string args[]) @safe
{
import std.stdio : stderr;
if (args.length != 2) {
stderr.writeln("usage: %s filename");
return;
}
}
This does not compile, because stderr, stdin and stdout are all
marked @system. Technically, I understand why they are marked
@system, but practically, most people would expect something like
this to Just Work, without having to mark main @system, or use ()
@trusted {...}();
I think given DIP 1000 and DIP 1028, its worth looking into
phobos and reviewing other "trivial" stuff that should work with
@safe but doesn't, and coming up with ways to fix them.
More information about the Digitalmars-d
mailing list