Doc Comments /
Statement
Difference (last change) (no other diffs, normal page display)
Deleted: 71,74d70
Foreach over Structs and Classes with opApply: Please add a hint about dg being the foreach body or something. After understanding this, the rest was obvious. |
Changed: 88,199c84
*![]() |
Statements
Examples
DigitalMars:d/statement.html#try
The following code prints "FileException" because the best matching catch clause seems to be determined at runtime, while equivalent code for C++ would print "Exception" instead because ex is declared as Exception.
![]() |
|
Messages
Shadowing by delegates
In the case where a variable in a delegate has the same name as a variable in the enclosing funtion, you say the variable in the delegate does not shadow the variable in the enclosing function and so there is no error.I see your point since the delegate is implemented as a separate function. However, the point is to save confussion and the delegate is logically part of the enclosing function (and shares the same stack frame). It may make sence to not allow shadowing by delegates.
DavidO?
Empty statement blocks for while/if
Can you have empty statement blocks for while loops and if statements? e.g.
![]() |
|
It would probably be beter if you could not for similar reasons to the for statement.
DavidO?
foreach grammar
DigitalMars:d/statement.html#foreach
why is ForeachType only defined as inout Type Identifier and Type Identifier but not also as in Type Identifier?
Because the default for the storage class is in DigitalMars:d/function.html#parameters
- Correct, but you can explicitly use the in storage class for general functions.
for grammar
DigitalMars:d/statement.html#for (ThomasKühne)
If Initializer declares a variable, that variable's scope extends through the end of Statement.
Neither does this represent the actual implementation nor the general scoping rules.
Links
Corresponding page in the D Specification
do ... while visibility rules
synchronized statement