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.
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.
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.
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.
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.