DIP 1012--Attributes--Preliminary Review Round 1
Jesse Phillips via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 28 14:47:32 PDT 2017
On Thursday, 27 July 2017 at 14:44:23 UTC, Mike Parker wrote:
> DIP 1012 is titled "Attributes".
>
> https://github.com/dlang/DIPs/blob/master/DIPs/DIP1012.md
> Thanks in advance to all who participate.
>
> Destroy!
My primary points
* Don't formally deprecate the keywords, there is not enough
justification to ever remove them.
* 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.
* Specifying inferred needs to be within druntime only, and thus
may not need to exist.
* I'm concerned user defined attributes could define a "defaults"
for functions.
I think the updated document needs some additional rework, here
are some examples:
# Rational
A number of issues with the existing functional attribute system
have come up through the years.
* Certain attributes don't have a name, e.g. All functions
''throws'' but this is not an existing attribute.
* The default attributes were not correctly chosen, e.g. all
class methods should be ''final'' unless specified otherwise, and
because of the first point declaring 'final:' at the top of the
class cannot be undone.
* AliasSeq is provided to manage Attributes, but it doesn't
handle built in attributes (I could be wrong but is what I'm
getting from the document even though it isn't explicitly stated)
* ...
# Description
Function existing attributes and their unnamed counterpart will
exist as an enum within core.attributes. This module will be
implicitly imported to provide the symbols without explicit
import or breaking existing code. The compiler will recognize the
non-@ based attributes as the corresponding core.attribute.
...
## Implementation Details
----------
module core.attribute;
enum Protection {
system,
safe,
trusted,
}
alias safe = Protection.safe;
...
-----------
The compiler will default functions to the first value of the
enum [for my example].
[So on and so forth]
More information about the Digitalmars-d
mailing list