Skip to content

Commit d2b8cf8

Browse files
authored
[spec/property] Add headings (#4173)
properties (stringof & mangleof) from common type properties. Explain how the common type properties apply to expressions. Separate derived type properties and user-defined type properties & add subheadings.
1 parent 67852fc commit d2b8cf8

File tree

1 file changed

+35
-13
lines changed

1 file changed

+35
-13
lines changed

spec/property.dd

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,44 @@ $(SPEC_S Properties,
44

55
$(HEADERNAV_TOC)
66

7+
$(H2 $(LNAME2 common, Common Properties))
8+
79
$(P Every symbol, type, and expression has properties that can be queried:)
810

9-
$(TABLE2 Properties for All Types,
11+
$(TABLE
1012
$(THEAD Property, Description)
11-
$(TROW $(RELATIVE_LINK2 init, $(D .init)), initializer)
12-
$(TROW $(RELATIVE_LINK2 sizeof, $(D .sizeof)), size in bytes)
13-
$(TROW $(RELATIVE_LINK2 alignof, $(D .alignof)), alignment size)
1413
$(TROW $(RELATIVE_LINK2 mangleof, $(D .mangleof)), string representing the $(SINGLEQUOTE mangled) representation of the type)
1514
$(TROW $(RELATIVE_LINK2 stringof, $(D .stringof)), string representing the source representation of the type)
1615
)
1716

1817
$(TABLE2 Examples,
1918
$(THEAD Expression, Value)
20-
$(TROW $(D int.sizeof), yields 4)
21-
$(TROW $(D (3).sizeof), yields 4 (because 3 is an int))
22-
23-
$(TROW $(D int.init), yields 0)
2419
$(TROW $(D int.mangleof), yields the string "i")
2520
$(TROW $(D int.stringof), yields the string "int")
2621
$(TROW $(D (1+2).stringof), yields the string "1 + 2")
2722
)
2823

29-
$(BR)
24+
$(H2 $(LNAME2 type, Type Properties))
25+
26+
$(P Every type has properties that can be queried. Every expression also
27+
has these properties, which are equivalent to the properties of the
28+
expression's type. These properties are:)
29+
30+
$(TABLE
31+
$(THEAD Property, Description)
32+
$(TROW $(RELATIVE_LINK2 init, $(D .init)), initializer)
33+
$(TROW $(RELATIVE_LINK2 sizeof, $(D .sizeof)), size in bytes)
34+
$(TROW $(RELATIVE_LINK2 alignof, $(D .alignof)), alignment size)
35+
)
36+
37+
$(TABLE2 Examples,
38+
$(THEAD Expression, Value)
39+
$(TROW $(D int.init), yields 0)
40+
$(TROW $(D int.sizeof), yields 4)
41+
$(TROW $(D (3).sizeof), yields 4 (because 3 is an int))
42+
)
43+
44+
$(H2 $(LNAME2 numeric, Numeric Properties))
3045

3146
$(TABLE2 Properties for Integral Types,
3247
$(THEAD Property, Description)
@@ -61,15 +76,22 @@ $(TROW $(D float.nan), yields the floating point NaN value)
6176
$(TROW $(D (2.5F).nan), yields the floating point NaN value)
6277
)
6378

64-
$(BR)
79+
$(H2 $(LNAME2 derived-type, Derived Type Properties))
80+
81+
$(P See:)
6582

66-
$(P See also:)
6783
* $(DDSUBLINK spec/arrays, array-properties, Array Properties)
68-
* $(DDSUBLINK spec/class, class_properties, Class Properties)
6984
* $(DDSUBLINK spec/hash-map, properties, Associative Array Properties)
85+
* $(DDSUBLINK spec/simd, properties, Vector Properties)
86+
87+
88+
$(H2 $(LNAME2 user-defined-type, User-Defined Type Properties))
89+
90+
$(P See:)
91+
92+
* $(DDSUBLINK spec/class, class_properties, Class Properties)
7093
* $(DDSUBLINK spec/enum, enum_properties, Enum Properties)
7194
* $(DDSUBLINK spec/struct, struct_properties, Struct Properties)
72-
* $(DDSUBLINK spec/simd, properties, Vector Properties)
7395

7496

7597
$(H2 $(LNAME2 init, .init Property))

0 commit comments

Comments
 (0)