On Monday, 10 March 2014 at 15:38:09 UTC, Timon Gehr wrote:
I think it can be phrased more universally "ForeachTypeList
symbols must
be evaluated as compile-time entities, if it is not possible,
implementation-defined compilation error happens".
...
I don't see how this is more universal.
CTFE stands for "Compile-Time Function Evaluation". When you
don't have functions or expressions (i.e. pure type list)
referring to it looks very confusing to me and I start guessing
if you mean some specific CTFE semantics I don't know about or it
is just a wording for "accessible during compile-time".
Also spec does not say that const-folding happens via CTFE as a
rule, thus you are exposing implementation details that way.
Looks like your intentions here are same as mine but exact
phrasing creates misunderstanding :)
5)
For static foreach statements, break and continue are
supported and
treated like for foreach statements over tuples.
It is impossible as far as I understand existing semantics.
Currently
placed continue/break refer to created scope and don't stop
iteration
over remaining template argument list members. This is not
applicable to
generic foreach.
...
This is not 'impossible', it is trivial to implement. Is your
point that you would prefer break and continue to affect static
foreach expansion?
Impossible in a sense that those are not applicable in
declaration context. Also break/continue do look weird in absence
of scope, I don't like it. Would prefer those to either affect
static foreach expansion or refer to outer loop (compilation
error if there is none).
6)
In "Iterating over members of a scope" example there is a
strange
Python-like colon after `static if` condition. Typo? :)
...
Nope. This is a language feature. See:
http://dlang.org/version.html
What a horrible creation! :O It is first time I see such static
if syntax in actual D code. Why was it introduced?
I think the description is actually not detailed enough to
warrant this critique. (In particular, it is not clear what
'ref' should do.)
I.e., I think currently the following code is ambiguous:
int y,z;
static foreach(x;Seq!(y,z)) x = 2;
// what is the value of y and z now?
With existing foreach y and z will remain int.init
If you change it to be `foreach(ref x; Seq..`, y and z will
change to 2.
For static foreach I want it to be 2 and `ref x` rejected at
compilation time as nonsense.