@safe, pure and nothrow at the beginning of a module

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 16 14:50:53 PDT 2014


On Saturday, 16 August 2014 at 20:48:25 UTC, monarch_dodra wrote:
> On Saturday, 16 August 2014 at 19:30:16 UTC, Jonathan M Davis 
> via Digitalmars-d-learn wrote:
>> On Sat, 16 Aug 2014 14:39:00 +0200
>> Artur Skawina via Digitalmars-d-learn
>> <digitalmars-d-learn at puremagic.com> wrote:

>>> @safe, @trusted, @system, shared, immutable, const, inout and 
>>> `extern
>>> (...)` affect child scopes. `synchronized` does too, but in a 
>>> rather
>>> unintuitive way; hopefully nobody uses this. ;)
>>>
>>> Other attributes, including 'pure' and 'nothrow' only affect 
>>> symbols
>>> in the current scope.
>>
>> It sounds like a bug to me if they're not consistent.
>>
>> - Jonathan M Davis
>
> Well, you got  @system to override @safe, but no @impure or 
> @throws. So the behavior can kind of make sense in a way. Maybe.

Except that attributes like const, immutable, shared, and inout
can't be reversed either (in fact @system, @trusted, and @safe -
and maybe extern - are the only ones from that list that can be,
so while I could see making that separation, that's not what's
actually happening.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list