Call to Action: making Phobos @safe

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 14 08:57:42 PDT 2016


On Saturday, 25 June 2016 at 22:44:37 UTC, Walter Bright wrote:
> Andrei identified a key blocker for D adoption is the 
> incomplete implementation of @safe. I'm working on the compiler 
> end. But Phobos has a lot of code that is pointlessly not 
> @safe, making it frustrating to write @safe code that calls 
> Phobos. Some are listed in Bugzilla, most are not.
>
> So here's what to do:
>
> 1. Pick a module, any module, let's say 'std.foo'.
>
> 2. Compile it:
>
>     dmd -unittest -main std/foo
>
> and run:
>
>     foo
>
> to verify that the unittests work.
>
> 3. Take a look at foo.d and look for a unittest that is not 
> marked @safe.
>
> 4. Add @safe to the unittest
>
> 5. Do Step 2 on it.
>
> 6. If it works, submit a PR with the annotation (well, try to 
> collect a few of these in one module)
>
> 7. If it doesn't work, find out where the unsafe code is and 
> fix it, and submit a PR.
>
>
> I've submitted maybe a dozen PRs against Phobos over the last 
> day from doing this. It's only a start.

It's possible that someone introduced new unittests that aren't 
explicitly @safe or @system, but with the exception of std.stream 
(because of imminent deprecation) all phobos unittests are now 
explicity tagged. So now, if you want to help make Phobos @safe, 
the steps are:

1. Pick a module, any module
2. Search for a @system unittest
3. Change @system to @safe
4. Figure out why it doesn't compile that way and either edit 
code or file bugs


Atila






More information about the Digitalmars-d mailing list