[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 19:15:02 +0200
User-agent: Thunderbird (X11/20060516)

On 07/24/2006 06:09 PM, Gabriel Dos Reis wrote:
"Bill Page" <address@hidden> writes:

| On July 24, 2006 11:40 AM Tim Daly wrote:
| > | > you can see what Aldor is doing by asking it to print the
| > generated lisp code.
| | Of course one can try to analyze the generated code, but if the
| definition of the language is adequate there should never be a
| need to do this.

Strongly agreed.

We should be at the point where, we have the definition of the
language on one hand, what the compiler does on the other hand, and
check whether it is the language that is defined that way or whether
the compiler has a bug.
-- Gaby

I also strongly agree. Clear language definition + a compiler implementation that meets that specification.

I hope there will be more discussions about Aldor semantics in places where it seems not to be clear enough. I for my part have read the AUG several times and there are still a few things unclear to me. Maybe I don't remember things well, but for things like

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

they are described at several pages in the AUG, but it would be nice to add a few more pages that explain "common pitfalls".

For example

#include "aldor"
#include "aldorio"

define CatA: Category == with;
A: CatA == add;

stdout << ((A add {foo(): () == {}}) has CatA) << newline;
stdout << ((A add {foo(): () == {}}) has with{foo:()->()}) << newline;

Is somebody able to guess the output of that program?

Well, it is as simple as this: The program does not compile.

>aldor -grun -laldor
"", line 7: stdout << ((A add {foo(): () == {}}) has CatA) << newline;
[L7 C15] #1 (Error) The domain is missing some exports.

I consider this a bug.

The AUG says in section 7.8 "Domains":

  The value of the expression "A add B" is a domain which exports
  those symbols exported by "A" and those exports defined in "B".

So the type of "A add {foo(): () == {}}" would be

CatA with {foo: () -> ()}

Now, replace the output lines with

stdout << ( A      has CatA) << newline;
stdout << ((A add) has CatA) << newline;

It still does not compile. But it should. Both A and "A add" are domains of type CatA.

What I wanted to demonstrate is that "A add {...}" has a type and is a value of its own.

But if used in a context like "X: CatX == ... " it does matter whether there is an "add" *explicitly* appearing on the right hand side. That is not just an ordinary assignment of constants, i.e.

constName: SomeType == somevalue;

I can live with that, and it is probably a good thing, but I think to figure out the difference of

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

is not something obvious. Be honest, who has read the AUG and could have explained the difference? There is certainly need for more documentation.

But that brings me to another question. In order to figure out what the Aldor language actually is, there is only the AUG to consult. If that is imprecise, who is going to have the last word if it comes to implement the details in the compiler? We certainly do not want different versions of the Aldor language.


reply via email to

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