[Aldor-l] Generators

Laurentiu Dragan ldragan at uwo.ca
Tue Nov 13 10:11:24 EST 2007


Stephen Watt wrote:
> Laurentiu,
> 
> What you say is true, but the language construct used in the last example
> would have  'a' constant over the scope in which it is used as a type.
> 
> for (a: MachineInteger, b: SmallPrimeField(a) in g repeat {
>     // here a and b are constant so it should be ok to use a in a type,
>     // and in particular in the type of b.
> }


Bill Page wrote:
 >
 > That is true but I think it can be properly argued that in all cases
 > above, the type of 'b'  in
 >
 >   for (a:MachineInteger, b:SmallPrimeField a) in g repeat {
 >
 > and
 >
 >   for i in g repeat {
 >           (a: MachineInteger, b: SmallPrimeField(a)) == i;
 >
 > and the type of 'SPF(x)' in
 >
 >    for (x, 0$SPF(x)) for x in 1..10;
 >
 > is constant *in this context*, i.e. with the tuple ( ... ) and within
 > the block { ... }. In other cases the Aldor compiler does compile code
 > which has types that are constant only within a given context.
 >
 > Regards,
 > Bill Page.

You are right, "for i in ..." makes i constant.

--
Laurentiu



More information about the Aldor-l mailing list