Skip to content

Commit 31668ea

Browse files
authored
[spec/attribute] Group attributes (#3558)
Add groups Mutability, Shared Storage, Function. Note: Safety attributes aren't included in Function Attributes because @System applies to variables (not documented yet). Add link for `auto`. Add Class Attributes group, move override here.
1 parent 3eb0987 commit 31668ea

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

spec/attribute.dd

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,9 @@ $(H3 $(LNAME2 export, $(D export) Attribute))
461461
a DLL or executable is importing a symbol from a DLL.)
462462

463463

464-
$(H2 $(LNAME2 const, $(D const) Attribute))
464+
$(H2 $(LNAME2 mutability, Mutability Attributes))
465+
466+
$(H3 $(LNAME2 const, $(D const) Attribute))
465467

466468
$(P The $(DDLINK spec/const3, Type Qualifiers, $(D const) type qualifier)
467469
changes the type of the declared symbol from $(D T) to $(D const(T)),
@@ -499,27 +501,30 @@ $(H2 $(LNAME2 const, $(D const) Attribute))
499501

500502
$(P See also: $(DDSUBLINK spec/declaration, methods-returning-qualified, Methods Returning a Qualified Type).)
501503

502-
$(H2 $(LNAME2 immutable, $(D immutable) Attribute))
504+
$(H3 $(LNAME2 immutable, $(D immutable) Attribute))
503505

504506
$(P The $(D immutable) attribute modifies the type from $(D T) to $(D immutable(T)),
505507
the same way as $(D const) does. See:
506508
)
507509
* $(DDSUBLINK spec/const3, immutable_storage_class, `immutable` storage class)
508510
* $(DDSUBLINK spec/const3, immutable_type, $(D immutable) type qualifier)
509511

510-
$(H2 $(LNAME2 inout, $(D inout) Attribute))
512+
$(H3 $(LNAME2 inout, $(D inout) Attribute))
511513

512514
$(P The $(DDSUBLINK spec/const3, inout, $(D inout) attribute) modifies the type from $(D T) to $(D inout(T)),
513515
the same way as $(D const) does.
514516
)
515517

516-
$(H2 $(LNAME2 shared, $(D shared) Attribute))
518+
519+
$(H2 $(LNAME2 shared-storage, Shared Storage Attributes))
520+
521+
$(H3 $(LNAME2 shared, $(D shared) Attribute))
517522

518523
$(P The $(DDSUBLINK spec/const3, shared, $(D shared) attribute) modifies the type from $(D T) to $(D shared(T)),
519524
the same way as $(D const) does.
520525
)
521526

522-
$(H2 $(LNAME2 gshared, $(D __gshared) Attribute))
527+
$(H3 $(LNAME2 gshared, $(D __gshared) Attribute))
523528

524529
$(P By default, non-immutable global declarations reside in thread local
525530
storage. When a global variable is marked with the $(D __gshared)
@@ -578,39 +583,39 @@ void main() { foo(); /* error, foo is disabled */ }
578583
makes the struct not copyable.
579584
)
580585

586+
581587
$(H2 $(LNAME2 safe, $(D @safe), $(D @trusted), and $(D @system) Attribute))
582588

583589
$(P See $(DDSUBLINK spec/function, function-safety, Function Safety).)
584590

585-
$(H2 $(LNAME2 nogc, $(D @nogc) Attribute))
591+
592+
$(H2 $(LNAME2 function-attributes, Function Attributes))
593+
594+
$(H3 $(LNAME2 nogc, $(D @nogc) Attribute))
586595

587596
$(P See $(DDSUBLINK spec/function, nogc-functions, No-GC Functions).)
588597

589-
$(H2 $(LNAME2 property, $(D @property) Attribute))
598+
$(H3 $(LNAME2 property, $(D @property) Attribute))
590599

591600
$(P See $(DDSUBLINK spec/function, property-functions, Property Functions).)
592601

593-
$(H2 $(LNAME2 nothrow, $(D nothrow) Attribute))
602+
$(H3 $(LNAME2 nothrow, $(D nothrow) Attribute))
594603

595604
$(P See $(DDSUBLINK spec/function, nothrow-functions, Nothrow Functions).)
596605

597-
$(H2 $(LNAME2 pure, $(D pure) Attribute))
606+
$(H3 $(LNAME2 pure, $(D pure) Attribute))
598607

599608
$(P See $(DDSUBLINK spec/function, pure-functions, Pure Functions).)
600609

601-
$(H2 $(LNAME2 ref, $(D ref) Attribute))
610+
$(H3 $(LNAME2 ref, $(D ref) Attribute))
602611

603612
$(P See $(DDSUBLINK spec/declaration, ref-storage, `ref` Storage Class).)
604613

605-
$(H2 $(LNAME2 return, $(D return) Attribute))
614+
$(H3 $(LNAME2 return, $(D return) Attribute))
606615

607616
* $(DDSUBLINK spec/function, return-ref-parameters, Return Ref Parameters).
608617
* $(DDSUBLINK spec/function, return-scope-parameters, Return Scope Parameters).
609618

610-
$(H2 $(LNAME2 override, $(D override) Attribute))
611-
612-
$(P See $(DDSUBLINK spec/function, virtual-functions, Virtual Functions).)
613-
614619
$(H2 $(LNAME2 static, $(D static) Attribute))
615620

616621
$(P The $(D static) attribute applies to types, functions and data.
@@ -672,7 +677,7 @@ private int y = 4; // y is local to module foo
672677
$(H2 $(LNAME2 auto, $(D auto) Attribute))
673678

674679
$(P The $(D auto) attribute is used when there are no other attributes
675-
and type inference is desired.
680+
and $(DDSUBLINK spec/declaration, auto-declaration, type inference) is desired.
676681
)
677682

678683
---
@@ -870,14 +875,17 @@ void main() @nogc
870875
}
871876
---
872877

873-
$(H2 $(LNAME2 abstract, $(D abstract) Attribute))
878+
879+
$(H2 $(LNAME2 class-attributes, Class Attributes))
880+
881+
$(H3 $(LNAME2 abstract, $(D abstract) Attribute))
874882

875883
$(P
876884
An $(DDSUBLINK spec/class, abstract, abstract class) must be overridden by a derived class.
877885
Declaring an abstract member function makes the class abstract.
878886
)
879887

880-
$(H2 $(LNAME2 final, `final` Attribute))
888+
$(H3 $(LNAME2 final, `final` Attribute))
881889

882890
$(UL
883891
$(LI A class can be declared $(DDSUBLINK spec/class, final, `final`) to prevent
@@ -887,6 +895,11 @@ $(LI A class method can be declared $(DDSUBLINK spec/function, final, `final`)
887895
$(LI Interfaces can define $(DDSUBLINK spec/interface, method-bodies, `final` methods).)
888896
)
889897

898+
$(H3 $(LNAME2 override, $(D override) Attribute))
899+
900+
$(P See $(DDSUBLINK spec/function, virtual-functions, Virtual Functions).)
901+
902+
890903
$(H2 $(LNAME2 mustuse-attribute, `@mustuse` Attribute))
891904

892905
$(P

0 commit comments

Comments
 (0)