DMD 1.005 release
BCS
BCS at pathlink.com
Wed Feb 7 19:37:41 PST 2007
Andrei Alexandrescu (See Website For Email) wrote:
> Kyle Furlong wrote:
>>
>> I agree with the point that metaprogramming needs more control
>> structures.
>>
>> static for, static foreach, static while, static do, static switch
>> case, etc.
>
static loops at any scope static if is allowed
>
> Static loops are not very useful without compile-time mutation.
>
> Andrei
Maybe some sort of const loop would work
static for(const i = 0; i< 10; i++) // i const outside of ()
{
}
If the the last two clauses were scoped as being at the end of the loop
then it might even be able to access const values computed during the
last pass.
const s = 356;
char[s] buf;
char[] buf2;
static for(const i = 1; cont; i<<=1)
{
static if(i < buf.length)
const bool cont = true
else
{
const bool cont = false
buf2.length = i;
}
}
Yeah, it's contrived )and brings up a pile of issues with regards to
scoping) but, it illustrates the point.
More information about the Digitalmars-d-announce
mailing list