Could assertThrown be made safe/trusted?

Jonathan M Davis jmdavisProg at gmx.com
Tue Jan 17 14:04:18 PST 2012


On Tuesday, January 17, 2012 20:28:52 Timon Gehr wrote:
> On 01/17/2012 08:21 PM, H. S. Teoh wrote:
> > On Tue, Jan 17, 2012 at 09:07:05AM -0800, Jonathan M Davis wrote:
> > [...]
> > 
> >> Exception itself isn't @safe yet (its constructor in particular), and
> >> I don't think that AssertError is either. A number of stuff like that
> >> in druntime and Phobos still needs to be marked @safe or @trusted.
> > 
> > [...]
> > 
> > Just out of curiosity, why isn't it marked @safe? I looked over the
> > source and didn't see anything immediately obvious that would preclude
> > @safe.
> > 
> > 
> > T
> 
> The code for it was presumably written before SafeD was invented.

That, and not many Phobos developers have been in the habit of using @safe. It 
isn't fully implemented, and any code in druntime or Phobos which is using it 
is generally newer. It's a lot like pure in that not all that much has been 
marked with it historically, making it kind of useless - though pure has 
generally been used more than @safe. Attribute inferrence is a big step 
forward in making as much as possible @safe and pure, but there's still plenty 
to do there.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list