(Integer, String) ~= (Integer, String)

View: New views
2 Messages — Rating Filter:   Alert me  

(Integer, String) ~= (Integer, String)

by Ralf Hemmecke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The code below compiles with

aldor -grun -laldor -DPRETEND abc.as

but fails at

aldor -grun -laldor  abc.as
"abc.as", line 32:         e2: Test T2 := create(c2)$Test(T2);
                    ..............................^
[L32 C31] #1 (Error) Argument 1 of `create$Test(AldorInteger, String)'
did not match any possible parameter type.
     The rejected type is Cross(AldorInteger, String).
     Expected type Cross(AldorInteger, String).

Any idea how I could do without 'pretend' in the 'main' function?
Note that a user could easily provid T3==>(String, Character, Integer)
and do similar things on the command line instead of inside a 'main'
function.

Ralf

---BEGIN abc.as
#include "aldor"
Test(T: Tuple OutputType): with {
         create: Cross T -> %;
}
== add {
        import from Trace;
         Rep == Cross T;
         create(c: Cross T): % == per c;
}
main(): () == {
         import from String, Integer;
        T2 ==> (Integer, String);
         t2: Tuple(OutputType) == T2;
         c2: Cross T2 := (1783, "Hallo");
#if PRETEND
         e2: Test t2 := create(c2 pretend Cross t2);
#else
         e2: Test T2 := create(c2)$Test(T2);
#endif
}
main();
---END abc.as

_______________________________________________
Aldor-l mailing list
Aldor-l@...
http://aldor.org/mailman/listinfo/aldor-l_aldor.org

Re: (Integer, String) ~= (Integer, String)

by Martin Rubey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Maybe the following shows the problem even more drastically.  After

Create(T: Tuple OutputType, t: Cross T): Test T == t pretend Test T;


the compiler will complain about Create(T2, c2) with exactly the same words as
Ralf noticed...

Martin

Ralf Hemmecke <ralf@...> writes:

> The code below compiles with
>
> aldor -grun -laldor -DPRETEND abc.as
>
> but fails at
>
> aldor -grun -laldor  abc.as
> "abc.as", line 32:         e2: Test T2 := create(c2)$Test(T2);
>                     ..............................^
> [L32 C31] #1 (Error) Argument 1 of `create$Test(AldorInteger, String)'
> did not match any possible parameter type.
>      The rejected type is Cross(AldorInteger, String).
>      Expected type Cross(AldorInteger, String).
>
> Any idea how I could do without 'pretend' in the 'main' function?
> Note that a user could easily provid T3==>(String, Character, Integer)
> and do similar things on the command line instead of inside a 'main'
> function.
>
> Ralf
>
> ---BEGIN abc.as
> #include "aldor"
> Test(T: Tuple OutputType): with {
>          create: Cross T -> %;
> }
> == add {
> import from Trace;
>          Rep == Cross T;
>          create(c: Cross T): % == per c;
> }
> main(): () == {
>          import from String, Integer;
> T2 ==> (Integer, String);
>          t2: Tuple(OutputType) == T2;
>          c2: Cross T2 := (1783, "Hallo");
> #if PRETEND
>          e2: Test t2 := create(c2 pretend Cross t2);
> #else
>          e2: Test T2 := create(c2)$Test(T2);
> #endif
> }
> main();
> ---END abc.as
>
> _______________________________________________
> Aldor-l mailing list
> Aldor-l@...
> http://aldor.org/mailman/listinfo/aldor-l_aldor.org


_______________________________________________
Aldor-l mailing list
Aldor-l@...
http://aldor.org/mailman/listinfo/aldor-l_aldor.org