[Aldor-l] Generators

Stephen Watt watt at scl.csd.uwo.ca
Mon Nov 12 10:23:28 EST 2007


I don't know whether we said it in tha AUG, but it is intended that you
cannot assign to loop variables inside the loop.  

Consequently they can be used in type expressions and having dependent 
crosses as "for" indices should be allowed.

-- Stephen


On Mon, Nov 12, 2007 at 04:04:30PM +0100, Martin Rubey wrote:
> Ralf Hemmecke <ralf at hemmecke.de> writes:
> 
> > So we should even add more testcases.
> 
> I think it's better to have good testcases than many. But I do not care too
> much.
> 
> > > for (a,b) in l repeat if a=1 then b := 2;
> > > etc.  Is the latter illegal, btw.?
> > 
> > Why should that be illegal?
> > 
> > Would you say that
> > 
> > For
> > 
> > #include "aldor"
> > import from Integer;
> > l: List Integer := [1,2];
> > for a in l repeat a := 42;
> > 
> > the compiler says
> > 
> > parrot:~/scratch>aldor aaa.as
> > "aaa.as", line 5: for a in l repeat a := 42;
> >                    ..................^
> > [L5 C19] #1 (Error) Cannot explicitly assign a `for' variable.
> 
> Hehe, good guess, don't you think?  (I did not cheat!)
> 
> > But where is this in the AUG?
> 
> Even if it isn't in the AUG, I think it's good behaviour.  It just doesn't make
> sense.
> 
> Martin
> 
> 
> _______________________________________________
> Aldor-l mailing list
> Aldor-l at aldor.org
> http://aldor.org/mailman/listinfo/aldor-l_aldor.org




More information about the Aldor-l mailing list