---BEGIN aaa.as
#include "aldor"
#include "aldorio"
main(): () == {
import from Integer;
T1 == List Integer;
T2 == List Integer;
t1: T1 := [1];
t2: T2 := t1;
stdout << "t1 = " << t1 << newline;
stdout << "t2 = " << t2 << newline;
#if DoesntWork
N1: ListType Integer == List Integer;
N2: ListType Integer == List Integer;
n1: N1 := [1];
n2: N2 := n1;
stdout << "n1 = " << n1 << newline;
stdout << "n2 = " << n2 << newline;
#endif
}
main();
---END aaa.as
woodpecker:~/scratch>aldor -laldor -DDoesntWork -fx aaa.as
"aaa.as", line 17: n2: N2 := n1;
..................^
[L17 C19] #1 (Error) There is no suitable interpretation for the
expression n1
The context requires an expression of type N2.
The possible types of the right hand side (`n1') are:
-- N1
If you remove "-DDoesntWork" the code compiles and runs fine.
In Aldor T1 and T2 are identical. Constant assignment does not define a
new type. That is different if you add the type (as is done for N1 and
N2). The compiler introduces two new domains N1 and N2 which are like
but different from List Integer.
Maybe that is confusing, but that's the way it is. (And it is sometimes
useful.)
Ralf
On 08/13/2007 12:35 AM, Weiss, Juergen wrote:
I found the old document about type equivalence in Scratchpad. It's:
A New Algebra System, May, 29 th 1984, James H Davenport. I have only
found a paper version. Maybe someone has an online version.
It states that:
1. Two named types are only equivalent if the names are the same.
2. Anonymous types are equivalent when stucturally equivalent
3. An anonymous type is never equivalent to a named type.
So following 1.
t1 == List Term
t2 == List Term
x : t1
y : t2
y := x
is not supposed to work,
but following 2.
x : List Term
y : List Term
y := x
is ok,
and following 3.
t == List Term
x : List Term
y : t
y := x
is not supposed to work as well
All examples are taken from the paper.
I am not sure how much of this design is preserved in the current
system. But without having had an intense look at the examples,
I got the impression, that they follow the rules above.
Regards
Juergen Weiss
Juergen Weiss | Universitaet Mainz, Zentrum fuer Datenverarbeitung,
[EMAIL PROTECTED]| 55099 Mainz, Tel: +49(6131)39-26361, FAX:
+49(6131)39-26407
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Gabriel Dos Reis
Sent: Monday, August 13, 2007 12:16 AM
To: Bill Page
Cc: axiom-developer@nongnu.org
Subject: Re: [Axiom-developer] "has" and "with" (was curious
algebra failure)
On Sun, 12 Aug 2007, Bill Page wrote:
| On 8/12/07, Gabriel Dos Reis wrote:
| > On Sun, 12 Aug 2007, Bill Page wrote:
| >
| > | If you prefer, now that we have this page nearly
finished we could
| > | rename it to remove the SandBox prefix, then all
subscribers would be
| > | notified of any further changes.
| >
| > That would be great!
| >
|
| Ok, now please refer to the page:
|
| http://wiki.axiom-developer.org/AnonymousCategories
Many thanks.
-- Gaby
_______________________________________________
Axiom-developer mailing list
Axiom-developer@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-developer
_______________________________________________
Axiom-developer mailing list
Axiom-developer@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-developer
_______________________________________________
Axiom-developer mailing list
Axiom-developer@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-developer