axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] types as values


From: Bill Page
Subject: [Axiom-developer] types as values
Date: Fri, 23 Sep 2005 14:07:13 -0400

On September 23, 2005 7:36 AM William Sit wrote:
> From www.aldor.org:
> > Types and functions are first class entities allowing them to be
> > constructed and manipulated within Aldor programs just like any
> > other value.
> > 
> Can some Aldor expert expand on this? For example, can functions be
> created, modified, and compiled and called all at run time? (People 
> used to do code modification on assembly languages and may still do,
> but the practice is I think no longer promoted, if not outright
> banned.)

In

http://wiki.axiom-developer.org/206InterpreterCodeGenerationFailedForFunctio
nReturningAType

I find that in Aldor at least it is possible to treat types as
values and return them as the result of functions. Both the
Axiom interpret and SPAD fail to compile my simple example.

But having defined the function tt2 in Aldor like this:

#include "axiom.as";
testtype2(): with {
    tt2: (Integer) -> Type;
} == add {
    tt2(x:Integer):Type == {
      x=0 => Integer;
      Float;
      }
    }

How can I use it in Axiom in a useful manner? For example,
if I write:

  (1) -> n:tt2(0)

Axiom says:

  "Category, domain or package constructor tt2 is not available"

which is true of course because it is 'testtype2' which is
the name of a **domain**. But even if I this:

 (2) -> intx := tt2(0)

   (2)  Integer
                            Type: Type
 (3) -> a:intx

   intx is not a valid type.

---------

I get what seems to be a peculiarly inconsistent result.

Any ideas?

Regards,
Bill Page.






reply via email to

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