Why is Throwable.TraceInfo.toString not @safe?

Paul Backus snarwin at gmail.com
Mon Jul 22 03:16:02 UTC 2019


On Sunday, 21 July 2019 at 18:03:33 UTC, Johannes Loher wrote:
> I'd like to log stacktraces of caught exceptions in an @safe 
> manner. However, Throwable.TraceInfo.toString is not @safe (or 
> @trusted), so this is not possible. Why is it not @safe? Can it 
> be @trusted?
>
> Thanks for your help!

Seems like it's because it uses the form of toString that accepts 
a delegate [1], and that delegate parameter is not marked as 
@safe.

[1] https://dlang.org/phobos/object.html#.Throwable.toString.2


More information about the Digitalmars-d-learn mailing list