[Top][All Lists]

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

non-constant constants was: Re: [Aldor-l] [Axiom-developer] Re: export

From: Ralf Hemmecke
Subject: non-constant constants was: Re: [Aldor-l] [Axiom-developer] Re: exports and constants
Date: Sat, 29 Jul 2006 07:43:05 +0200
User-agent: Thunderbird (X11/20060719)

Hi Bill,

I turned exports into a function, as you'd probably want to call it more than once.

I don't understand the relevance of whether exports is a function
or not. As a generator we can use it as often as we like. No?

Try the following piece of code.

#include "aldor"
#include "aldorio"

main(): () == {
        import from Integer, List Integer;
        fun(): Generator Integer == generate {
                yield 0;
                yield 1;

        const: Generator Integer == fun();

        stdout << [fun()] << newline;
        stdout << [fun()] << newline;
        stdout << [const] << newline;
        stdout << [const] << newline;
---END aaa14

>aldor -grun -laldor

I agree that const is not constant. But a Generator is inherently destructive.

If you like you could also say something like
  a: Record(x: Integer) == [1];
  a.x := 0;
and the "constant" a changes. But you should note that the last line is
  set!(a, x, 0)
so that is a destructive function and thus you should expect strange things. The BANG functions (like set!) are only for people who know what they do.


reply via email to

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