[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Re: [Aldor-l] exports and constants

From: Ralf Hemmecke
Subject: [Axiom-developer] Re: [Aldor-l] exports and constants
Date: Mon, 24 Jul 2006 23:57:29 +0200
User-agent: Thunderbird (X11/20060516)

On 07/24/2006 08:12 PM, Bill Page wrote:
On July 24, 2006 1:15 PM Ralf Hemmecke wrote:
... What I wanted to demonstrate is that "A add {...}" has a type and is a value of its own.

Hmmm... in Aldor values do not have types. "A add {...}" is
an "add expression".

OK, maybe my formulation was a bit misleading. I agree that if you look at the memory location where a value is stored Aldor does not store type information, but still the _compiler_ should know about the type of that value. Same for "A add {...}". Of course that is a value since I can assign it to a constant (or maybe even to a variable--have not tried this), so the compiler should know its type. There are no things in Aldor without type.

X: CatX == Dom;
X: CatX == Dom add;

The concept of inheritance in Aldor is obviously very important.
In an add-expression the domain appearing to the left of 'add'
is called the parent domain. This is described in the users

#include "aldor"
#include "aldorio"

define CatA: Category == with;
define CatB: Category == with;
define CatC: Category == with;
define CatAB : Category == Join(CatA,  CatB);
define CatABC: Category == Join(CatAB, CatC);
ABC: CatABC == add;
X: CatA ==  ABC     @CatAB;
Y: CatA == (ABC add);
Z: CatA == (ABC add)@CatAB;
W: CatA == (ABC add)@CatABC;

stdout << (X has CatABC) << newline;
stdout << (Y has CatABC) << newline;
stdout << (Z has CatABC) << newline;
stdout << (W has CatABC) << newline;

I am sure you can guess the output of the above program.
But in order to have it recorded in the mailing list, I give the output here.

>aldor -grun -laldor

Please take some time to understand why for Y the answer is false but for Z it is true. Compare that to the output for X. Is the output for W clear?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]