make @safe "non-escapable"?
Robert
jfanatiker at gmx.at
Wed Feb 6 16:23:06 PST 2013
Ok. Now I see what you mean. Good point, maybe it makes sense to extend
my proposal to simply state that @trusted, @system and @safe are simple
not overridable.
On Thu, 2013-02-07 at 01:07 +0100, Era Scarecrow wrote:
> >> @trusted { //disallowed for (bulk) function/type
> >> declarations
> >> //intended only for bits of code or for
> >> functions:
> >> //Otherwise an easy unchecked breeding ground
> >> for bugs!
> >> int test1() {} //error
> >> int test1() @safe {} //error
> >> int test1() @system {} //error
> >> int test1() @trusted {} //error, yes it is
> >> //even if explicit
> >> a = b;
> >> }
> >
> > Why would the @safe definition be an error?
>
> Because getting adding functions to a @trusted area would allow
> some lazy programmers to say 'it just works', it would be so easy
> to just remove @safe (and it would work). In general @trusted
> (code blocks) in my mind shouldn't allow function/structs/any
> type of extra declarations as it would be so easy to make it
> 'seem safe' while not properly checked, or adding a new function
> in while not wanting to move it back and forth between writing &
> testing.
>
> Sides allowing @safe in a @trusted zone while nothing else works
> doesn't make sense. It would be better to disallow period all
> rather than give an easy route for problems later. At least with
> @system and @safe code you know where you stand.
More information about the Digitalmars-d
mailing list