axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] Re: conditionally defined functions


From: Ralf HEMMECKE
Subject: [Axiom-developer] Re: conditionally defined functions
Date: Fri, 17 Sep 2004 15:56:55 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616

Hi Martin,

Hmm, I think it is my point indeed. I don't know Aldor syntax, but my idea was
roughly

 define A(P: Cat1): Category == with {
    arg: () -> Cat1
    f: % -> P;
 -- the operation arg returns a domain...
    arg () == P
 }



 -- Assume B should be a domain.
 B(Q: Cat2): Cat3 with {
    if Q has arg: () -> Cat1 then {g: % -> arg()}
 }

Oje, I guess that is too much to hope for. I am not one of the language designers, but since everything in Aldor/Axiom is first class in principle it should work.

There is, however, a little problem which is not so obvious in your "argument code arg()". What if I say the following?

DomA(P1: Cat1, P2: Cat1): A(P1) == add {
  b: Boolean := false;
  arg(): Cat1 := {
        free b;
        b := not b;
        if b then P1 else P2;
  }
  ...
}

Now, what is the type of B(DomA(P1,P2))? Does
  B(DomA(P1,P2))
have the same type as
  B(DomA(P1,P2))?

Ralf




reply via email to

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