axiom-developer
[Top][All Lists]
Advanced

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

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


From: Ralf Hemmecke
Subject: Re: [Aldor-l] [Axiom-developer] Re: exports and constants
Date: Sat, 29 Jul 2006 09:31:24 +0200
User-agent: Thunderbird 1.5.0.5 (X11/20060719)

Unfortunately Aldor treats named categories differently than
anonymous ones:

"7.5 ... Note that Aldor is constructed so that a domain is only
a member of a named category if it explicitly inherits from the
category - not if it merely exports the same collection of
(explicit) declarations."

I think being able to use anonymous categories is quite
important because we really do want to be able check for just
the presence of explicit declarations. The names artificially
assigned to these declarations is not important to us and of
course it would be rather awkward to have to name every
declaration in the system.

Well, I like to speak Aldor ;-). Your reference to the AUG above exactly means that there is one "F" output below. Nothing else.

---BEGIN aaa15.as
#include "aldor"
#include "aldorio"

macro MACCAT == with {foo: () -> ()}
macro MACDOM == add {foo(): () == {}}
define CatA: Category == MACCAT;
A: CatA == MACDOM;
M: MACCAT == MACDOM;
stdout << (A has CatA) << newline;
stdout << (M has CatA) << newline;
stdout << (A has MACCAT) << newline;
stdout << (A has MACCAT) << newline;
---END aaa15.as

>aldor -grun -laldor aaa15.as
T
F
T
T

And if you enter the definitions of A and M above into "aldor -gloop"
you'll see.

%7 >> M
  () @
 with foo: () -> ()
    ==  add ()

                                           Comp: 0 msec, Interp: 0 msec
%8 >> A
  () @
CatA with
    ==  add ()

In fact, A exports a bit more than M, namely that it belongs to CatA. Since "has" is executed at runtime, it certainly makes a difference whether the program just has to check the existence of a symbol "CatA" or whether is must check all the exports i.e. signatures (which could be hundreds for complicated categories).

Also if I did use named categories shouldn't I use the 'define'
keyword since ultimately I will probably be interested in using
the value of these categories in forming other domains?

Right. But I have not yet seen any instance where the compiler treats category definitions with or without "define" differently. But that current behaviour can not be relied on. So it is better practice to write "define".

Ralf




reply via email to

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