[Issue 12941] Everything should be @unsafe by default, and explicitly vetted (and documented) as @safe

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jun 19 23:32:18 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12941

--- Comment #9 from timon.gehr at gmx.ch ---
> Are you sure you have excluded pointer arithmetic in the section under
> expressions?

Yes, this section only allows basic types as operands
(http://dlang.org/type.html).

> Also, slicing of static arrays should be considered @system, because unless we implement scope properly, they will break @safe-ty.

This is taken care of. Slicing of static arrays is not included in the list.

> Furthermore, delegates that close over struct members are @system if the closure leaves the construction scope, for example:

This is a very good point (the list does not actually include delegate literals
yet though, only function literals. This terminological distinction is possibly
confusing, but I think it is what the compiler developers use.)


I'll extend my post slightly:

The following are also @safe:
- taking the length of an @safe expression of type T[] for some T
- indexing into @safe expressions of static array type
- operations on associative arrays (TODO: examine them one by one.)

TODO: determine which delegate literals are @safe.

--


More information about the Digitalmars-d-bugs mailing list