[Aldor-l] Generators (destructuring cross)

Martin Rubey martin.rubey at univie.ac.at
Thu Nov 8 03:11:46 EST 2007


> Maybe this alternate coding helps to explain why it doesn't and
> perhaps why we should not expect it to work for dependent crosses ('a'
> is not constant in this scope):
> 
> #if DoesntCompile
>        stdout << "test dependent:" << newline;
> -- Cross(n: MachineInteger, SmallPrimeField n)
>        for (a:MachineInteger, b:SmallPrimeField a) in g repeat {
>                stdout << a << " " << b << newline;
>        }
> #endif

Oh yes, I tried this, but I didn't see... I guess you are right.  Let's compare
with

         for i in g repeat {
                (a: MachineInteger, b: SmallPrimeField(a)) == i;
                stdout << a << newline;
                stdout << b << newline;
         }

Now, SmallPrimeField(a) is again in type context, but it's scope is delimited
by the braces, where it is constant.

Thanks,

Martin






More information about the Aldor-l mailing list