On 06/08/2015 11:33 AM, ketmar wrote:
On Mon, 08 Jun 2015 09:27:34 +0000, Marc Schütz wrote:
ergo, `auto` is not a storage class, but type placeholder.
No.
and it's not a storage class too. `foreach (auto i; 0..42)` doesn't work,
white `foreach (immutable i; 0..42)` works ok.
foreach(static i;0..42) doesn't work either, and 'static' is a storage
class.
'immutable' is a type constructor besides being a storage class.
The attributes allowed in `foreach' are those that are considered to
make sense, and they are specified in the grammar:
http://dlang.org/statement.html#ForeachTypeAttributes
Furthermore, both of those declarations are valid:
static i = 2;
immutable j = 3;
What is important is that the type was left out, not that it was
replaced by 'auto'.