August 16, 2014 Re: @safe, pure and nothrow at the beginning of a module | ||||
---|---|---|---|---|
| ||||
On Sat, 16 Aug 2014 14:39:00 +0200 Artur Skawina via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > On 08/16/14 13:58, Philippe Sigaud via Digitalmars-d-learn wrote: > > On Sat, Aug 16, 2014 at 1:30 PM, Artur Skawina via Digitalmars-d-learn > > >> http://forum.dlang.org/post/mailman.125.1397731134.2763.digitalmars-d@puremagic.com > > > > Okay... > > > > So @safe includes child scopes. I suppose @trusted and @system work in the same way. > > > > *but* > > > > nothrow, @nogc and UDA's do not include child scopes. Putting them at the beginning of a module will not affect methods in aggregates... > > > > What's the situation for pure? (I don't have a D compiler handy right now, or I would test it myself). > > @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 |
August 16, 2014 Re: @safe, pure and nothrow at the beginning of a module | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | 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@puremagic.com> wrote:
>
>> On 08/16/14 13:58, Philippe Sigaud via Digitalmars-d-learn wrote:
>> > On Sat, Aug 16, 2014 at 1:30 PM, Artur Skawina via
>> > Digitalmars-d-learn
>>
>> >> http://forum.dlang.org/post/mailman.125.1397731134.2763.digitalmars-d@puremagic.com
>> >
>> > Okay...
>> >
>> > So @safe includes child scopes. I suppose @trusted and @system work
>> > in the same way.
>> >
>> > *but*
>> >
>> > nothrow, @nogc and UDA's do not include child scopes. Putting them
>> > at the beginning of a module will not affect methods in
>> > aggregates...
>> >
>> > What's the situation for pure? (I don't have a D compiler handy
>> > right now, or I would test it myself).
>>
>> @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.
|
August 16, 2014 Re: @safe, pure and nothrow at the beginning of a module | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarch_dodra | 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@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 |
August 16, 2014 Re: @safe, pure and nothrow at the beginning of a module | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarch_dodra Attachments: | On Sat, 16 Aug 2014 20:48:23 +0000 monarch_dodra via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > Well, you got @system to override @safe, but no @impure or @throws. So the behavior can kind of make sense in a way. Maybe. talking about attributes. the unability to reverse 'final:' makes me mad. i'm almost ready to patch the compiler myself and start using this feature even if it will be never accepted in mainline, like i'm doing now with 'foreach (auto i; ...)'. |
Copyright © 1999-2021 by the D Language Foundation