Are contracts intended for verifying @safety;
Jonathan M Davis via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Nov 7 13:05:32 PST 2016
On Monday, November 07, 2016 20:38:00 Somebody via Digitalmars-d-learn
wrote:
> > So, while I don't know what the official stance is, I'd suggest
> > having the function be @trusted and having the documentation
> > make it clear what the preconditions are so that the calling
> > function can be marked @trusted.
> >
> I reckon you meant marking the calling function @safe?
No. @trusted. The calling function could only be marked @safe if the callee
were @trusted, and I was suggesting that it be marked @system so that it's
then clear to the caller that they need to pass the correct arguments for it
to be okay to treat it as @safe and mark the caller as @trusted. If need be,
the contract can be documented to make it clear what's required for it to be
reasonable to mark the caller as @trusted.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list