@safe status

dsimcha dsimcha at yahoo.com
Fri Feb 5 17:38:34 PST 2010


== Quote from strtr (strtr at spam.com)'s article
> Walter Bright Wrote:
> > Every function in Phobos needs to be reviewed and tagged as safe,
> > trusted or system as appropriate.
> I am sorry if this is totally stupid, but shouldn't it be possible for the
compiler to do this? addition to -profile maybe
> It might also be interesting if the compiler were to generate the most
restrictive protection attributes for everything, which would still compile or
course ;)

Actually, more generally a generate-attributes flag for the compiler might be a
pretty useful thing.  I have no idea how feasible this would be at an
implementation level, but it would definitely work at a theoretical level (except
for @trusted, which needs to be checked manually).  It would spit out the same
source files, but with any attribute that would compile added.  For example, all
functions that would compile as pure would be marked pure.  All functions that
would compile as nothrow would be marked nothrow.  All unannotated member
functions that would compile as const would be marked inout (once inout is
implemented for member functions).  All function parameters that could be const
without breaking anything would be marked as such.  This assumes that noone
overloaded const and non-const versions of some member function to do semantically
different things, but if they did they deserve what they get.



More information about the Digitalmars-d mailing list