[Aldor-l] The following could be suitable if imported

Ralf Hemmecke ralf at hemmecke.de
Sat Oct 20 20:50:04 EDT 2007


Hello,
I have already discussed it with Johannes personally, but it seems that 
my answer was only partially correct.
Since that seems to be a more general problem I forward this mail also 
to aldor-l.

Indeed the reference to the AUG page 90 would suggest that the program 
compiles.

And it does indeed compile if the function definition of "test" is 
commented out.

But how can one use foo?

The only way I found was a (seemingly very strange) construction like
Replace

      b : DOM(2,2) == foo(a,a);

by

   if 2=2 then b: DOM(2,2) == foo(a,a);

I've no idea whether the produced code is reasonable, but at least one 
can shut up the compiler.

Ralf

On 10/17/2007 08:18 PM, Johannes Middeke wrote:
> Hello,
> 
> 
> I get just another error message I cannot get rid of. I use the
> following programme which is but a simplified version of my original
> sources.
> 
> File: TMP.as __________________________________________________________________
> #include "aldor"
> #include "aldorio"
> 
> Int ==> MachineInteger;
> 
> DOM(a : Int, b : Int) : with {
>     0 : %;
>     if (a = b) then foo : (%,%) -> %;
> } == add {
>     Rep == Int;
>     0 : % == per 0;
>     if (a = b) then foo(a : %, b : %) : % == 0;
> }
> 
> test () : Int == {
>     import { integer : Literal -> % } from Int;
>     import { foo : (%,%) -> % } from DOM(2,2);
>     local a : DOM(2,2) == 0;
>     local b : DOM(2,2) == foo(a,a);
> }
> _______________________________________________________________________________
> 
> Upon compiling I get the following:
> 
> _______________________________________________________________________________
> $ aldor -Fx -laldor TMP.as
> "TMP.as", line 19:     local b : DOM(2,2) == foo(a,a);
>                    ..........................^
> [L19 C27] #1 (Error) There are no suitable meanings for the operator `foo'.
> The following could be suitable if imported:
>   foo: (DOM(2, 2), DOM(2, 2)) -> DOM(2, 2) from DOM(2, 2), if 2 = 2
> _______________________________________________________________________________
> 
> Searching the web suggested that aldors compiler might not be clever
> enough to notice, that the condition 2 = 2 really is true. But on the
> other hand, the code follows rather closely an example from th euser
> guide (page 90).
> 
> So, is there anything I can do to bring foo into scope? Maybe some
> compiler flag to enable compile time evaluation of conditions?




More information about the Aldor-l mailing list