Purity, @safety, etc., in generic code

H. S. Teoh hsteoh at quickfur.ath.cx
Sun Feb 17 22:19:19 PST 2013


On Sun, Feb 17, 2013 at 10:08:13PM -0800, Walter Bright wrote:
> On 2/17/2013 9:23 PM, Jonathan M Davis wrote:
> >So, I think that the problem is essentially solved for @safe, pure,
> >and nothrow as long as the implementation issues get solved.
> 
> Yup, I believe that for templates using inference is the way to go.
> Currently, dmd does a rudimentary job of it, much improvement is
> possible.

That's good to know.

It would be very cool if things like std.conv.to and std.format can be
inferred pure/const/nothrow/@safe if the particular set of parameters
with which they are instantiated permits it. There are many places in my
code where I'd love to be able to use std.format, but can't because it
would break pure/@safe/nothrow.


T

-- 
There are two ways to write error-free programs; only the third one works.


More information about the Digitalmars-d mailing list