DIP 1012--Attributes--Preliminary Review Round 1

Jesse Phillips via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 31 12:27:46 PDT 2017


On Friday, 28 July 2017 at 23:25:35 UTC, Nicholas Wilson wrote:
> On Friday, 28 July 2017 at 21:47:32 UTC, Jesse Phillips wrote:
>> * Remove the whole program defaults, I'm ok with it being 
>> changed in a re-implementation of the runtime (like the 
>> embedded example), we just don't need the extra confusion 
>> within user code.
>
> The program defaults are there to make @safe by default a 
> thing, and betterC by default a thing, which are covered in the 
> _three Primary points_ of the semesters Vision document[1]. 
> These would not normally be set (i.e. opt in).

I read that as more, Improve Druntime and phobos's us of @safe so 
that it becomes more usable.

>> * Specifying inferred needs to be within druntime only, and 
>> thus may not need to exist.
>
> I think there is usefulness in having it, particularly as the 
> meta-default (defaultAttributeSet). Walter has ben pushing for 
> some time to infer attributes by default. This would provide a 
> directive for the compiler to do so. Please elaborate.

I don't expect inference to happen outside templates. Besides if 
the compiler infers the appropriate attributes by default, isn't 
1. a default attribute redundant and 2. specifying inference 
redundant as the compiler defaults to inferring?

>> * I'm concerned user defined attributes could define a 
>> "defaults" for functions.
>
> you mean user UDAs (if not please explain)? the default 
> application of UDA is for core attributes only.

Yes I'm User's UDA (user defined attributes). I expected it 
wouldn't apply outside the context of core.attributes.


>> The compiler will default functions to the first value of the 
>> enum [for my example].
>
> ( That would provide a pessimistic default and debates the 
> ability for the compiler to infer)

Yes, just throwing in an example structure and why I mentioned 
[for my example]. But as said earlier infer and default are at 
odds.

>> [So on and so forth]
>
> Thanks for your suggestions.
>
> [1]: https://wiki.dlang.org/Vision/2017H2




More information about the Digitalmars-d mailing list