@@ -10,6 +10,7 @@ $(SPEC_S Deprecated Features,
10
10
11
11
$(TABLE2 Deprecated Features,
12
12
$(THEAD Feature, Spec, Dep, Error, Gone)
13
+ $(TROW $(DEPLINK body keyword), 2.075, 2.091, , )
13
14
$(TROW $(DEPLINK Hexstring literals), 2.079, 2.079, 2.086, )
14
15
$(TROW $(DEPLINK Class allocators and deallocators), , 2.080, 2.087, )
15
16
$(TROW $(DEPLINK Implicit comparison of different enums), 2.075, 2.075, 2.081, )
@@ -60,6 +61,38 @@ $(SPEC_S Deprecated Features,
60
61
$(DD The feature is completely gone)
61
62
)
62
63
64
+ $(H3 $(DEPNAME body keyword))
65
+ $(P 'body' was a keyword used to specify a function/method's body in the presence of contracts
66
+ ---
67
+ class Foo
68
+ {
69
+ void bar(int i)
70
+ in { assert(i >= 42); }
71
+ body { /* Do something interesting */ }
72
+
73
+ string method(string s)
74
+ out(v) { assert(v.length == s.length); }
75
+ body { /* Do something even more interesting */ }
76
+
77
+ void noBody() { /* No contracts, no body */ }
78
+ }
79
+ ---
80
+ )
81
+ $(H4 Corrective Action)
82
+ $(P Use the 'do' keyword instead (introduced v2.075.0)
83
+ ---
84
+ void bar(int i)
85
+ in { assert(i >= 42); }
86
+ do { /* Look ma, no body! */ }
87
+ ---
88
+ )
89
+ $(H4 Rationale)
90
+ $(P The 'body' keyword was only used for this single purpose.
91
+ Since D grammar aims to be context free, this common word was reserved,
92
+ which led to frequent trouble for people interfacing with other languages
93
+ (e.g. javascript) or auto-generating code.
94
+ )
95
+
63
96
$(H3 $(DEPNAME Hexstring literals))
64
97
$(P Hexstring literals can be used to enter literals in base 16.
65
98
---
0 commit comments