May 30, 2020 Re: DIP 1028 "Make @safe the Default" is dead | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Treleaven | On 5/30/20 7:39 AM, Nick Treleaven wrote:
> On Friday, 29 May 2020 at 21:18:13 UTC, Walter Bright wrote:
>> On 5/29/2020 2:07 AM, Timon Gehr wrote:
>>> It would be great if `@safe:` did not affect declarations that would otherwise infer annotations.
>>
>> The idea is the simple, general rule that:
>>
>> attribute declaration;
>> attribute { declaration; }
>> attribute: declaration;
>>
>> behave the same way.
>
> To preserve this, then please can we have `@safe module foo;`.
We already have that in Yoda notation:
module foo; @safe:
|
May 30, 2020 Re: DIP 1028 "Make @safe the Default" is dead | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bruce Carneal | On Friday, 29 May 2020 at 05:08:44 UTC, Bruce Carneal wrote:
> Thanks Walter.
Thanks to everyone in the commmunity for being nice and saying "Thank you." As a cautionary tale, Guido Van Rossum, former BDFL of Python, resigned over flamewars on the := operator in Python, the same arguments were rehashed over and over.
|
May 30, 2020 Re: DIP 1028 "Make @safe the Default" is dead | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On 5/30/20 4:02 PM, Andrei Alexandrescu wrote:
> On 5/30/20 7:39 AM, Nick Treleaven wrote:
>> On Friday, 29 May 2020 at 21:18:13 UTC, Walter Bright wrote:
>>> On 5/29/2020 2:07 AM, Timon Gehr wrote:
>>>> It would be great if `@safe:` did not affect declarations that would otherwise infer annotations.
>>>
>>> The idea is the simple, general rule that:
>>>
>>> attribute declaration;
>>> attribute { declaration; }
>>> attribute: declaration;
>>>
>>> behave the same way.
>>
>> To preserve this, then please can we have `@safe module foo;`.
>
> We already have that in Yoda notation:
>
> module foo; @safe:
Again, not the same. Read the full thread that you quoted above.
-Steve
|
May 30, 2020 Re: DIP 1028 "Make @safe the Default" is dead | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Saturday, 30 May 2020 at 20:14:04 UTC, Steven Schveighoffer wrote:
> On 5/30/20 4:02 PM, Andrei Alexandrescu wrote:
>> module foo; @safe:
>
> Again, not the same. Read the full thread that you quoted above.
And even aside from inference, it doesn't actually work for most the attributes.
@safe is the exception, it DOES descend into classes and structs. But the others don't.
We should make this actually work for everything.
1) Make inferred_attr: NOT apply to template/auto functions.
2) Add inverse attributes for all things. (or tri-state, true/false/null)
3) Solve the child scope problem somehow consistently.
|
May 30, 2020 Re: DIP 1028 "Make @safe the Default" is dead | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Saturday, 30 May 2020 at 20:29:37 UTC, Adam D. Ruppe wrote:
> On Saturday, 30 May 2020 at 20:14:04 UTC, Steven Schveighoffer wrote:
>> On 5/30/20 4:02 PM, Andrei Alexandrescu wrote:
>>> module foo; @safe:
>>
>> Again, not the same. Read the full thread that you quoted above.
>
> And even aside from inference, it doesn't actually work for most the attributes.
>
> @safe is the exception, it DOES descend into classes and structs. But the others don't.
>
> We should make this actually work for everything.
>
> 1) Make inferred_attr: NOT apply to template/auto functions.
> 2) Add inverse attributes for all things. (or tri-state, true/false/null)
> 3) Solve the child scope problem somehow consistently.
+1 This could take us a good way out of the "attribute swamp".
|
May 31, 2020 Re: DIP 1028 "Make @safe the Default" is dead | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Treleaven | On 5/30/2020 4:39 AM, Nick Treleaven wrote:
> To preserve this, then please can we have `@safe module foo;`. This would change the default on a module basis to @safe, but still infer e.g. function template bodies as @system where necessary. This feature would allow modules from different projects, including ones written before this feature would be added can coexist happily. There would be no breakage, unlike DIP 1028 (which I BTW would support at a lower preference than the above feature, apart from unmarked extern(C) declarations being @safe).
The implementation PR for DIP1028 still allowed inference for templates as before.
|
May 31, 2020 Re: DIP 1028 "Make @safe the Default" is dead | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Sunday, 31 May 2020 at 19:15:19 UTC, Walter Bright wrote:
> On 5/30/2020 4:39 AM, Nick Treleaven wrote:
>> To preserve this, then please can we have `@safe module foo;`. This would change the default on a module basis to @safe, but still infer e.g. function template bodies as @system where necessary. This feature would allow modules from different projects, including ones written before this feature would be added can coexist happily. There would be no breakage, unlike DIP 1028 (which I BTW would support at a lower preference than the above feature, apart from unmarked extern(C) declarations being @safe).
>
> The implementation PR for DIP1028 still allowed inference for templates as before.
In a safe-by-default world, `@system:` doesn't.
In a system-by-default world, `@safe:` doesn't.
This has been discussed verbatim in the DIP1028 threads.
|
June 10, 2020 Re: DIP 1028 "Make @safe the Default" is dead | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Saturday, 30 May 2020 at 20:29:37 UTC, Adam D. Ruppe wrote:
> We should make this actually work for everything.
>
> 1) Make inferred_attr: NOT apply to template/auto functions.
> 2) Add inverse attributes for all things. (or tri-state, true/false/null)
> 3) Solve the child scope problem somehow consistently.
+1. Would be great to see the possibility to apply other built-in attributes on a module basis, like `@nogc module test;` or `@trusted module test` etc. It seems very natural to expect this feature to work in that way. The only problem is what to do with UDAs, but probably they also should be applied to everything in the same manner.
|
Copyright © 1999-2021 by the D Language Foundation